When mobs walk outside of your chunk rendering the mob is still visible as it's standing right o the edge, but the game doesn't load it's ai so it just stands there, in as with this screenshot, floats.
How to replicate:
-Spawn a few mobs that move around a lot, or tries to get away from you (i used bees in the picture because that was when i realised it).
-Let the mob go to the edge of your chunk rendering.
Easiest way to do it is spawning cats/ocelots/foxes and letting them run away from you on chunk rendering 2
some issues i realised is that when the gamemode switches the hostile mobs are still loaded in and are visable but dont disappear until the other half of the chunk they are in is loaded. this caused me a bit of lag (experimenting on a laptop) due to the extra entities loaded.
I wasn't able to reproduce this with foxes.
Based on the screenshot, it seems like your issue is MC-159350. Does that describe what you're experiencing?