I own both, and both are excellent weapons that I would trust my life to any day - you really can't make a bad choice.
The XD feels much better in my hand, but has a crappy trigger. Sloppy, long reset, and the travel is generally off. The XD also has a very heavy combat recoil spring - much heavier than the equivalent Glock. I wish my Glock had a grip safety like the XD – I love this feature. It’s another safety feature that just stays out of the way. I’m hugely “Anti-Manual Safety”, so any safety that just works and doesn’t get in my way is good by me. The LCI on the XD is much more functional than the one on the Glock. The XD also has a fully supported chamber, but I never let that bother me on my Glock. The XD has a much higher bore axis than the Glock, which in theory increases muzzle flip, but I can’t tell the difference. However, it does give me the feeling that I’m looking OVER the top of my XD whereas I feel like I’m looking DOWN the top of my Glock. That’s probably just my perception. The XD is also much heavier than the Glock.
As far as my Glock, I have a Gen 3 and it’s just slippery all over. The grip and the slide. The XD has a decent texture on the grip and has both front and rear serrations on the slide. The tenifer on the glock slide is much more durable, but is also very slippery. When I train with the XD I can get hot and sweaty and still fight on, but with the Glock I start to feel like I’m holding a greased egg. I’ve bobbled a few malfunction drills on my Glock because I couldn’t get a solid grip on the slide when my hands were sweaty. I have the sandy grip tape on the Glock that has improved the frame dramatically but it didn’t stay on the slide. The Glock trigger is also miles above the XD’s – it is solid. Clean takeup, crisp press, short reset, no slop. Glock parts are also a commodity – easy and cheap to get almost anywhere. The accessory market for Glock is also far outpaces the XD market, though as the XD has caught on, most manufacturers of after market accessories are supporting both platforms more consistently.
So, in summary, I truly feel they are a wash. They both have pros and cons, but nothing that makes one stand out more than the other. Both are flawless shooters. I typically carry my Glock more because the Compact (4”) has a smaller grip than the XD Service (same 4”), making it easier to conceal for me. But I wouldn’t hesitate to carry the XD.
I know, I probably didn’t make it any easier for you, and in reality you should just get one of each. I would start with the XD, then graduate to the Glock later.
BTW - have you tried shooting .40 yet? It's not a caliber to learn on... I would borrow or rent one first. A G23 is not for the faint of heart...