Pistols and most other firearms are made to function for tens of thousands rounds with out parts wearing out. Here is an example of a pistol being fired 50,000 times with cleanings at every 7,000 rounds and a few springs at each 10,000 proactively. Nothing was broken during that time. This an extreme case but he has done this with a number of other models and has gotten similar (but not quite as good) results.
Firearms that have been used for generations and that are still functioning fine are the norm and not the exception.
As to ammunition contamination we are a 100 years since getting your powder wet was an issue. Modern brass cased cartridges are pretty well sealed up solid with crimping of both the primers and actual bullet. In the case of defensive and military ammunition they add extra sealant sometimes for an extra measure. For an example of how little effect even things like penetrating oil has read the following.