It does not make sense that those standing close to battle will always receive XP, while a character fighting in battle has no bearing on whether they receive XP.
I heavily use magic in combat, but when a character is distanced too far from the fight, when an opponent dies, the distanced character does not receive XP, while those that are closer to the opponents do.
The result is often that a caster who did all the work to weaken, and even provide the kill from the effect of their casting (such as burning, poison, etc) gets no XP for it, while those nearby, who often didn't lay a single blow (because the magic handled things, while others were kept out of poison / flame fields), do get XP - for nothing.
XP based on distance from fight is a non-reasoning means to gauge XP earnings, as it typically has the opposite effect as what it is trying to accomplish. In the very least, the eligible distance to receive XP should be significantly increased.