Probably has to do with ghost blocks, the server thinks there are blocks at that location while the client doesn't show them, so the server tries to prevent illegal movement by placing you back where you were before the illegal movement
Here is a video demonstrating the issue
The cursor issue also occurs if you get hit while the game is minimized
This is so annoying, hopefully it gets patched soon