I recently bought a new compact gun (CZ P01) and the Springfield XD (and XDm) and the Glock 19/23 were both among my finalists while shopping.
Both have great reputations for reliability. Both can be accurate, and both can make good carry or range guns.
The Glocks are marginally smaller/lighter than their competition in nearly all measurements. While the size and weight differences are not great, when taken as a whole, the Glock is usually a near perfect compromise for a carry gun. Slightly narrower, slightly shorter, significantly lighter (though the XD isn't heavy), and greater capacity (over the standard XD) makes for a great carry package. Though, the added weight may make the XD a better range gun.
IMO the XD and XDm have better triggers than Glock. I like the grip angle better. I've shot both in the past and much prefer shooting an XD to a Glock. Around here, the XD tends to run $75-100 less than a Glock, and the XDm runs $25-50 less.
For me, I picked an alloy CZ P01. If I was to get a polymer gun this round, I was still torn between the two. The Glock has the edge for carry, but overall I may like the XD and XDm better, and the price savings of the XD over the Glock or XDm may put it over the edge for me if I buy new (if I buy used, the Glocks are easier to find on the used market at the right price, so then things would likely flip). Eventually, I may end up with both, I'll likely end up with one or the other in the next 10-15 months.
They are close enough, that I really think there is no wrong answer between the two. Maybe do what I did, make a list of what you like about each and then try to determine which factors are more important for you. Neither is clearly an improvement over the other, so even if it ends up coming to a coin toss, I don't think you can go wrong.