That's a tough question. The M&P series of pistols has had it's share of issues. If you buy it new then you will have the latest and greatest version that doesn't share the problems of SOME of the early M&P's. There is also a lot of internet chatter about the M&P 9mm not being accurate. There may indeed be M&P's that aren't as accurate as others. That is a tough call. You may get a good one (most likely) or you may get a bad one (unlikely).
The Glock 19 is a legend. Glock has also had more than it's share of problems. The difference is that Glock almost never admits to a problem. There was the "silent" upgrade, the numerous feeding problems that led to the followers being revised 6 or 7 times (try sorting out that mess when you have older magazines), extractor problems, ejector problems. The new Gen4 Glock 19 is a nightmare of unreliability. Even the Gen 3 Glock 19's have issues that Glock still hasn't sorted out.
My advice...Buy a brand new M&P 9mm or an older used Glock 19 and you'll have an amazingly reliable weapon.
"Quid Clarius Astris"