This comes down to animation frames/locking and how slow the server is to respond. See also: Being able to move at the tail end of a spell cast and still have it go off, and being out of AoE telegraphs before they completely finalize but still getting hit because the server resolved the attack before your position was updated.

With practice, you'll get used to it.