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?
I will upgrade when my device is many generations out of date. So no one really wants to buy one and I will then buy not the latest but a generation or two “out of date” so it’s cheaper. So I have a heap of phones over the years that no one wants. Not even me.
I try to get rid of my old stuff ASAP, it reduces clutter both physically and mentally.
I know many people who had their old phones and computers lying around because they didn't invest the time to transfer the data. Not long after, the phone was unusable either due to hardware problems or forgotten passwords, and the data is lost forever.
I take my previous phone kayaking. Once I have downloaded the appropriate maps over wifi, I can use it for navigation, logging and photography without being worried by the prospect of dropping it in the water.
I never sell anything, everything finds a new life.
I got a Sony Xperia Compact from maybe 2016. I use it as a bicycle navigator / recorder. Recently it stopped reading SIMs, probably rusty contacts, but all I need is wifi to update OSMAnd and send me the tracks I recorded.
I also have a very old tablet, maybe 2014. My SO uses it to view movies with VLC and TV via TVHeadend.
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