I have both, but in 9 mm and am selling the XDM and replacing it with another Glock. The XDM is a very good gun, but the trigger is not as crisp as the Glock, plus the reach to the trigger is just slightly greater by a very small amount, but it's enough that I tend to pull my shots a bit to the side unless I concentrate very hard. The XDM grip is also just enough longer that if you intend to CCW it, it is more difficult to conceal.
I was truthfully surprised to find myself liking the Glock better as I had bought the XDM first because I liked the feel of the grip better and liked the 19+1 capacity. What I found was that I really had difficulty shooting the XDM well. Even after hundreds of rounds of practice I was just inconsistent with the XDM. When I got the Glock I shot it well from the first magazine.
Another reason I like the Glock better is that you can pretty much do any gun smithing for repair or modification yourself, no need to send it away. Join the GSSF and you not only get a discount on another Glock, but you can go to the armorers school. I haven't been yet, but I'm going. Just like with 10/22's and AR's being able to do your own repairs and modifications is a very good thing in my book.
All that being said, the XDM is a very good gun, but for me the Glock works better.
ETA: Whichever you get, if there is a likelihood you'll be using it for self defense, get the night sights. Saving money there is false economy.