THe good thing with linux, that it's totally transparent, you can easily find what's wrong, if you look at the right place.
First I would check journalctl, dmesg, running processes with htop, if I can see something wrong, unexpected. Check hard drive smart and run short selft test with gsmartcontrol.
Here is a general troubleshooting guide from arch wiki: https://wiki.archlinux.org/title/General_troubleshooting
I know you use ubuntu, but most of the commands here are the same on all distros, basically anything not related to pacman should be the same on your system
Ubuntu wiki has a similar guide, but shorter, guide, maybe start here: https://help.ubuntu.com/community/TroubleShootingGuide