This is just something that happens because of the delay between the server and your client. So it can be more common if you have a bad connection, but happens to everyone regardless sometimes. Essentially, when your opponent places a block, the server registers that the block is placed. Since you are moving forward during the time it takes for the server to tell your client that the block was placed (the higher your ping, the longer this delay is), you end up in the space where the block is. Once your client receives the information from the server that the block is supposed to be there, the block is rendered, even though you are standing in its spot, causing you to glitch and lag.