I own 2 semi-auto pistols: a Glock 20 (Gen III) and an M&P 9 (with Apex sear installed.) I consider both pistols equal in quality, durability, and reliability, but I greatly prefer the fit of the M&P in my large hand. The M&P feels like it was designed to fit a human hand, whereas the Glock feels like it was designed by someone who has never seen a human hand. In fact, if S&W were to make an M&P in 10 mm, I wouldn't own a Glock.
Although I prefer the fit and feel of the M&P, there are several advantages to the Glock which make it worth considering:
1) There are far more aftermarket parts and accessories available for the Glock. There are several major sight, barrel, and holster makers who still haven't started making (as many) products for the M&P.
2) My Glock 20 in 10 mm is noticeably more accurate for deliberate aimed firing at distances of 25 yards and greater. My M&P also has good accuracy, but not quite as good as the G20. This may just be a matter of the individual guns I own, or it may be that the 10 mm is a little more accurate cartridge than the 9mm. In my G20, I usually shoot carefully assembled hand loads, but I usually shoot low cost fmj practice ammo in my M&P9. That could also make a difference. Generally speaking, I have no reason to believe that either a Glock or an M&P can be expected to have an advantage in accuracy.
3. The Glock Model 19 is a very handy and versatile size. S&W does not make a model in a comparable size. The G19 does not fit my large hand well, but if it fits your hand, that could be a good reason to get a Glock.
4. The stock Glock trigger works better for me, even after I installed the Apex sear in my M&P.
5. A quick glance at the trigger of my Glock tells me whether or not it is cocked. If the Glock trigger is in the forward position, then the action is cocked and ready to fire (but it doesn't tell me whether or not there is a round in the chamber.) If the trigger is in the rear position, then I know the pistol is not ready to fire. This is a convenience for me. With the Glock you can confirm that there is a round in the chamber by looking at or by touching the extractor. With the M&P, you can look through a hole in the top of the barrel to see if there is a round in the chamber, but there is no way to confirm the round in the chamber by touch.
Overall, this is a minor concern because I always pull the slide back and check the chamber every time I pick up any pistol (or any other firearm.)
To me the choice between the two comes down to which you find the most annoying: the poor trigger feel on the M&P or the inexcusably poor design of the grip on the Glock.
Try them both for fit, but be sure to shoot them both one handed. I have known several shooters who can shoot a Glock pretty well when using both hands (I, for one), but who can't shoot it nearly as well one handed because they can't get a good, consistent, one-handed grip on the Glock. Although you will usually want to use both hands when shooting, you must be able to shoot a self defense pistol one handed.