Usually around 2-3 years. That's usually around when my current phone stops receiving software updates and by then I can find a good deal on an outgoing model.
For instance I upgraded to a Pixel 7 Pro when the 8 came out. I sold my 6 Pro for a decent amount and my total cost of upgrading was something like 300 bucks which was worth it to me to not have to worry about it for another few years.