I had an old laptop do this some years ago and it was because the graphics card was broken. I had dual graphic card and found a way to disable the broken one in bios (dedicated one, could continue on intel graphics) but the computer was too old to reliably use much longer and it died even more a few months later.
If you like Ubuntu I can only recommend Debian with KDE desktop (don’t install the default gnome DE).
I just switched recently and it’s a very clean feeling. No snap and no nonsens. Just stable and trustworthy.