I have always said 2 years, but because every new iPhone feels more or less like an incremental upgrade now, i say it's more like 3 - 4 years now. For example, iPhone 7 to 8 or X to Xs is not worth it, and Xs Max to 11 Pro Max is also something i would not do, considering the high pricing of those phones. You just need to keep the phone in good condition and have the battery replaced every year or two.
My 8 Plus for example i will have for one year now soon (Xr didn't appeal to me), and i have no intention of upgrading so far. And yes, upgrading to the Xs Max or 11 from the 8 Plus would be more than just an incremental upgrade, i know. But my phone already has so many features, i do need everything single bit that's new.
If i pay 1000 - 1500$ for a phone (outright and full payment) i am not going to replace it a year later, unless i'm crazy rich. I have to work for those things, and i cannot justify spending atleast 1099$ in the Apple Store (plus tax), just to replace that expensive phone just one year later with almost the same phone that is slightly improved.
I had my 5s for a bit over 2 years, the 6s close to 3 years and the 8 Plus i wanna keep atleast until September 2021. Have it since December 2018.