I have done a lot of testing regarding this and my results boiled down to this:
Settling a city for an important strategic point or ressource is worth it throughout the game. That being said, there is a point where you should stop settling cities without a specific purpose, if you want to achieve fast win times. The exact turn is dependant on your expected win. A formula could look like this:
Expected turn to win E(t). R is the production time of a Settler, the ability to rush-buy a Settler with faith or gold.
The exact turn where you should not build any more new settlers: E(t) - (75-R).
To put it in words: You should stop settling around 75 turns before your expected victory. If you think you're going to be winning the game with a Space Victory at around t200, you should not build any new settlers after t125, unless you can rushbuy them. Of course, some factors change this, primarily how good the city is and how many chops it has.
I arrived at this conclusion for two reasons: I played a lot of games where I peacefully settled more than 20 cities at around t105. Settler costs were absolutely escalating, we're talking about 30-40 turns of production for one Settler outside of the capital. That is with the policy card slotted in. Second, I don't think having 23 or 25 cities over 20 cities helped me very much in winning. There is a point, for example in science victory, where science is not the bottleneck anymore, but centralized production and chops. That point is imho at around 2500 science. Having 5000 science per turn over 2500 rarely benefits you, since with both you are just 1-turning every tech. And 5000 science doesn't help you build your parts much faster either. It's similiar with other victory types.
I think mathematically it just makes more sense to build military units instead of settlers after 20 cities. Those units are cheaper to produce than 30 turn settlers, give you Eurekahs, and don't stop after just one city. They have lots of upward potential with pillaging, getting peace deals and getting cities. I'm sure you can peacefully expand up to 25 or even 30 cities and still get decent win times, but I don't think it's "optimal".
So the rule of thumb is: Stop building settlers at around 75 turns before you expect to win, or if you've already settled more than 20 cities. If you still want to grow your empire, building military might be a better investment.
If you regularly win your games at around t300, then settling on t150 is definitely worth it, it would probably be worth it to settle up to t200 or later. As
@Denkt said it often doesn't need more than 25 turns to get a city online, and for your investment to pay off.