I used to get a new one every two years. Back then the changes were big enough to make it worthwhile. Nowadays there is not much to get from a new phone other than the hardware keeping up with the software and an improved camera.
I’d say, as with any device, keep it until it annoys you or doesn’t get any more security updates.
My iPhone 11 from 2019 starts to feel laggy and the touch screen is not responding as well anymore. Battery health is still over 90% but due to higher energy demand of the newer OSs and apps I often still need to juice up during the day. So this year I’m finally going to get the new model but I’ll keep the 11 as a webcam.