I may not be a typical user, but I've run my last few iphones and macbooks until the battery gave up the ghost. I haven't really needed more features or raw horsepower for quite some time, so the battery ends up being the limit I hit.
I use Android, but this is me, too. I keep it until the battery goes bad or until it breaks.
iPhones and MacBooks can be serviced to replace the battery.
My iPhones typically get a fresh battery around the 3-year mark, or whenever the battery health dips below 80%, and do a second tour of duty with someone in the family. In all cases so far, the OS goes out of support and apps stop working before the second battery degrades.