In Minecraft 1.18 Pre5 - hardcore mode, kill yourself, then fly outside the loaded chunks in spectator mode and find an animal just outside the loaded chunks. If you click on animal you become stuck inside the animal and unable to exit by pressing shift like you would normally, inside the loaded chunks.
Also I got the same thing clicking on a minecart chest in unloaded area.
Linked issues
Comments 4
This duplicates MC-157812. The chunks are not loaded properly, causing the unusual behavior with spectating entities.
Probably caused by / the same issue as MC-157812