Personally, if I had to choose between 9mm and .40 S&W, it should be no surprise I would choose the former (and most people certainly feel that way). That said, the first two carry guns I owned back in 2005 were .40 S&W, and I carried .40 for eight years until in 2013 I sold my forties and switched over to 9mm. But in the last 2-3 years I started shooting .357 SIG and .40 S&W again. My M&P's are chambered in 9mm these days, but my SIG P229 is chambered in .357 SIG and .40 S&W. I find the extra weight of the P229 not only softens the .40 S&W to shoot more like a 9mm out of a lighter gun, but the .40 S&W also appears to have some things still going for it (
An Alternate Look at Handgun Stopping Power | Buckeye Firearms Association).
Although 9mm is about as good as .40S&W (and some say better because of the extra capacity and reduced recoil), the latter does have the following advantages in my
opinion:
1. Other than capacity, it does everything as well or better. Most of the things it does better are either marginal or debatable, but one metric that seems to favor the .40 S&W is its one-shot-stop percentage which is on par with .357 Magnum and .357 SIG (which appears to be about a 10-11% increase over 9mm). That is significant in my opinion.
2. In my opinion, this is likely due to its increased ability to deliver hydrostatic shock. At least three studies show that incapacitation via hydrostatic shock is consistent if the bullet can deliver at least 500 ft. lbs. of kinetic energy. That's too tall an order for 9mm but it is not beyond the capability of .40 S&W.
3. Another advantage is that in some states it is illegal to hunt medium-size game with a 9mm but legal with a .40 S&W. The heavier and more powerful .40 S&W is still not ideal for whitetails, I admit, but you could do it, especially with a .40 S&W carbine or at least a pistol with a 5" or longer barrel.
4. There were also times during the past year that I couldn't find 9mm but I could still find .40 S&W. Don't get me wrong, most of the time both were gone, and when 9mm started to get replenished, I found it before .40 in many cases, but there were certainly still many times when I could find .40 and 9mm, and historically that has been particularly true when the shortages weren't as bad as they were with the COVID-19 plandemic.
Most of my carry pistols are chambered in 9mm, but I still shoot .40 and .357 SIG (which is even better yet in my opinion, but .40 is less expensive). I prefer 9mm or .380 ACP for smaller guns, but for large compacts or full-size pistols, I think there are some advantages to the more powerful calibers. Again, that's just my opinion but I was just curious how others felt about it these days.