Anybody who knows me knows how deep I am in the Glock ecosystem I am since I started shooting in 1990ish.
I shot a early edition Gen 3 Glock 35 running 165/180 GD and Lawman for 25K (easily) rounds from 2005 thru 2020 I did not have the issues that were reported by guys like Erick G and Chuck H but:
1. My gun was agency maintained with regular recoil rod changes, using mags with upgraded followers and 11 recoil mag springs.
2. I had dedicated carry mags and training mags.
3. I ran a light relatively infrequently.
Knowing everything I know now, if somebody was new to the 40 cal game, I would be saying Gen 5 Glock or M&P all the way given the market support one could have for the respective platforms.
I think that if you are not running a light, and you do as I did above re ammo/spring/mag protocols, a used Gen 3/4 .40 cal Glock is just fine. I would replace all springs and followers, inspect and replace all do dad parts as needed, fit it with a SCD, put six dollops of grease on it ( 4 metal rail points, around the barrel and on the connector) and shoot it.