@andrei Certain mods such as Regen sends packets to trick the server into giving you more health (Since it thinks more time has passed). Disable or change the settings in those mods to stop being kicked.
Bit late but I had the same issue and it was fixed by just removing Optifine. If it still occurs after that, try removing the fabric API and or sodium.