Working the range with the military I can't tell you how many thousands of rounds are fired from the M9 each year but it's more then most people will ever fire. On an annual inspection I have never found an M9 that didn't pass. Ive seen broken locking blocks but that's an easy fix and that's about it. Shoot it, clean it and repeat often.
A little of this, but go read Mr.GunsandGear M9 review or real talk or whatever on YouTube. He was a company (battalion?) armorer for a few years. His take is most of the bitching about the M9 was that there was never sufficient maintenance on them. Mostly things like springs were not replaced, even though they had tens of thousands of rounds through them, leading to some reliability issues.
Reading up on the Glock 17, you get in to replacing little things as mentioned like the recoil spring, maybe trigger spring or striker spring, etc. about every 5000-10000 rounds. Maybe a ejector at about twice that.
Velocity and pressures on non-magnum handguns is generally low enough you aren’t going to shoot out a barrel (not in your life) and so long as you do things like replace the recoil spring at vaguely reasonable intervals the thing isn’t going to batter itself in to falling apart.
Look at many C&R ex-military handguns. Many of them probably saw a few thousand rounds per year down their throat for rather worn examples and probably didn’t get things like springs replaced (well, not until they had real issues and in a lot of cases NEVER). With rare occasions the biggest issues you see are worn magazine springs, occasionally worn recoil springs and a lesser degree trigger and hammer springs or extractor springs.
Rifles will absolutely burn out a barrel in a few thousand rounds and might crack a bolt in 2-4x that. The receiver may never die for a steel one. An aluminum would probably will wear out eventually, but even then it might live tens to hundreds of thousands of rounds with proper lubrication and cleaning.
My 2 cents even if I was going to wear out a barrel I wouldn’t worry about it unless it took specialist tools to replace. A Glock, 1911, etc. meh. It takes 60 seconds to replace a barrel and they are a tiny fraction of the cost of the ammo you’d run through it. An AR platform I don’t worry too much about it either as it is user replaceable with just a couple of tools and not much skill. And they are also often pretty cheap (I’ve never spent more than $130 on an AR barrel and the scoped ones I own can also do MOA or less than MOA with the right load).