Something similar happened to me a few times. Except it says I was killed by a slime, but I was stuck on the "world generating" screen. Even after I build a crude house around the portal to prevent slimes from spawning. A few times it also just crashed the game. But eventually it would work, but I lost all my XP and some items. Super frustrating to not be able to do anything while "in limbo" after going through the portal (either direction) and be killed by a stupid slime. I'm sure part of it is because my windows laptop can barely handle the game so it is slow to load when going through portals. But surely there's got to be a way to fix this.
Forgot to add info:
v1.19.40
Bedrock
World Seed: -8219632010780896324
Portal Coordinates: 476, 15, 249