I was a Glock guy for 25 years and carried them at my PD job. Started out with an ancient, very early Gen2 Glock 21. Carried it on duty for 19 years, even shot in some informal competitions that a local sportsman's club used to put on every summer. I have over 50,000 rds through that gun. Aside from some of my reloads when I started reloading that I didn't get sized right, it has never malfunctioned. I then moved to a Gen4 G22 when a new Chief mandated that we had to carry issued guns. Carried it for about a year. 2000 rds or so, no mechanical issues, but the slide started rusting right away. Glock claimed that it was a nitride treatment issue, but refused to do anything about it, so I just kept it wiped down. Last was a Gen3 G19, personally owned that I carried for 2 or 3 years when another new Chief allowed us to carry personally owned guns again. 4 or 5 thousand rds, again no issues at all. I also have an ancient, early Gen2.5 G26 that I carried for backup and off duty for close to 20 years. 10,000 rds or so, never an issue.
I have a severe problem with Glocks customer service and corporate policies, so I had been looking for quite some time for an alternative to Glocks. Something that ran just as well and was as light to carry but was more ergonomic and got me away from Glocks. I tried an original Sigma (fit my hand VERY well, but the trigger was awful and, although I didn't know it then, the early ones were a train wreck), and an early 1.0 version of the M&P (very ergonomic, accurate and reliable but the trigger, again, sucked). Although Glock triggers aren't the best, they aren't bad, so I stuck to the Glocks.
I bought a very early 9mm Shield after a friend bought one to let me try. The trigger was a LOT better than the original M&Ps I had tried, so I was pretty enthused when S&W announced the release of the 2.0. The Shield replaced my G26, so I was down to just my G19 and the G42 I sometimes pocket carried. At the urging of an online acquaintenance, I bought a full sized 9mm 2.0 and tried it out. It turned out to be just what I had been looking for. VERY ergonomic, great trigger, accurate and reliable through 3 or 4 thousand rounds now. I liked my M&P so much that I was able to ditch the G19, as well. I started carrying my 9mm 2.0 on duty last spring and couldn't be happier. The choice wasn't an easy one, because I also had to spend a lot of cash on holsters and support equipment, including $100.00 for a new duty holster. I'm still happy I did it and would do it again in a heartbeat.
Having said all that, Glocks are good guns. They work well, are accurate enough and are, usually, as reliable as the day is long. I didn't get rid of my Glocks, they sit in the safe in case they are needed since I already have mags and support equipment, they are proven reliable and are paid for. In my case, I have had several bad experiences with Glock's customer service and don't care for some of their corporate policies that come from them being based in Austria and not understanding the gun culture in the US at all. That was my decision, I don't expect others to make the same one. The guns are good and serve well. You could do a lot worse than carrying them. However, from my experience, the M&P is better. Good luck with your choice, either should serve you well.