I'm (very gradually) switching from a 2014 Android phone to a 2017 Android phone, both secondhand. I'd like something that can run Lineage OS (and wasn't entry-level several years ago), but both still manage most of what I need.
Most people I know with Android phones keep them at least 3-4 years. (Off the top of my head: one switched from his Windows phone a couple years ago, another has an old Samsung one with a physical home button.)
Similar with Apple: I know one person who will not give up his 6s until Apple stops supporting it (and only begrudgingly then); I know a number of other people with the 6s, and one with the new SE.
That said, I'm pretty sure all of that comes more from the perspective of money than saving the earth.
Edit: somewhat unrelated, but I hear a lot of people mention how Apple is much better with OS updates. That's true (although Lineage helps, and manufacturers are getting slightly better), but app support for old versions of iOS is horrendous. I almost never see support for more than 2 old versions of iOS, if that. Meanwhile, ~85% of apps run fine on Android 4.4 and half or so get updates, and just about all do on Android 6.