I had a totally outdated and probably insecure Samsung S6 edge 2 years ago that started rebooting randomly. I think that prior to that it was so old I could only install stuff from f-droid and aurora because roots certs installed on that old android version were too old for playstore to work. Too bad as you can't easily find smartphones in similar sizes anymore.
Knocking on wood my pixel 6a still going strong after 2 years.
Did that for 20 € for my Oppo Find X3 Pro at my closest tech store and saved me from buying a brand new phone