For me, the best time is when the new phone is announced, then buy the version from a year ago. You get a bit of a discount, the issues with the phone have been ironed out during the first year of updates and the old phone is basically the same thing as the new one, with minor changes you are unlikely to notice. We reached a point where smartphones are so good in just about everything now that improvements are only incremental. Every new phone has a slightly better camera, slightly faster silicon etc., but these things will not be noticed in normal usage. I don't know what you have to do with the phone to notice the difference between the A17 and the A16 chips.
So, unless you're someone who upgrades annually, follow your own upgrade schedule (that you made beforehand, also accounting for the cost of other devices you will have to replace eventually) and when the time comes that you are in the upgrade period financially-wise, buy the last year's phone at a reduced price compared to the new model.
So, unless you're someone who upgrades annually, follow your own upgrade schedule (that you made beforehand, also accounting for the cost of other devices you will have to replace eventually) and when the time comes that you are in the upgrade period financially-wise, buy the last year's phone at a reduced price compared to the new model.