I’m poking a whale with sticks here, but I guess it could be some sort of race condition. Maybe 2 conflicting daemons fight with each other on bootup. If the first wins, your system is fine, if the second wins, your system is not fine.
Could you try using the hardware on another system with Ubuntu18.04 installed? It’s important as well, to exclude hardware issues, before diving into further problem analysis.
Speaking of Ubuntu 18.04…
Perhaps you could consider using a newer LTS version of Ubuntu, like, for example, 20.04 or even 22.04.
There are a lot of changes between the major version and it may also be the case, that your issue is simply fixed with a newer version.
It’s a possibility you should check out, especially if your Ubuntu 18.04 wasn’t yet really used a lot.
In my experience I have noted that ALL computers run on smoke. If you let the smoke out, they don’t run anymore very well if at all.
Has there been anything spilled on the machine?
When was the last time you cleaned it up?
Have you tried a live usb boot drive?