I have 3 XDM's 2 are 45's one is a 9mm.
A good friend has a 40.
JMO , I reload for my 45's and get very good hand held groups at 25 & 50 yards.
I like the 9 in that it holds a ton of rounds and has very little recoil feels great in my hands but is not as accurate past 20 yards for me.
I shoot my friends 40 and like it (XDM 5.25 .)
But you should try them if you can before buying one.
"witch one is better 40 or 45 caliber please help "
JMO There is no such thing as what is better for someone else.
Go by how a pistol feels for you.
I find my needs are different than others and go by what will fill my needs.
I do most of my range time at 25 meters indoors and 50 yards if I make it to an outdoor range.
So I buy guns even my carry ones that group well at 25 yards.
I have big hands and the xdm's feel like compacts to me 4.5 models.
I use mine for carry along with other full size pistols.
But your needs and wants might be the total opposite of mine.
I reload for my 45's so that cuts down on the price of ammo.
45 or 40 there is no right or wrong JMO comes down to each shooter.
Best of luck and go by your needs and try to shoot both before you buy one...