If you start swimming and hit an entity for the first time while swimming you would stop swimming for a second on a client, but not on a server, desyncing the player position between the client and server.
Steps to reproduce:
Set your gamemode to creative mode
Teleport to a nearest ocean monument
Give yourself a sword and start swimming near the edges of a monument while attacking entities.
Eventually you would get stuck, even though you're not touching any blocks
Linked issues
Attachments
Comments

Thank you for your report!
We're tracking this issue in MC-129568, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
This is already tracked in MC-129568