Usually I replace a smartphone because it has some hardware fault that makes it unusable and it is hard to repair or the cost of repair vs capability is not very favorable. Even if I was replacing smartphone before they died, I would probably sell them anyway. Do people really have various phones in working order waiting in a drawer?
Usually I replace my phone when the battery is almost dead and a full charge doesn't last more than a few hours. At that point the phone is usable but not good enough to sell. I usually keep it as an emergency backup phone
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.