Updated description by GoldenHelmet
1. Tame a cat/dog/parrot and let it follow you.
2. Swim or boat across an ocean or down the middle of a river.
3. After a while, get back on to dry land.
Your pet follows you, and teleports if necessary to stay near.
Pets get left behind. They do not move fast enough when floating on water to keep up. They will not teleport to you until you are next to dry land and unseated from the boat. After just 8 seconds (the time it takes a boat to travel 4 chunks) they can be so far behind that they are no longer in simulated chunks, and therefore will not teleport to you at all.
Cats and dogs following me are disappearing. I believe it has to do with unloading chunks as when I go back and see them they start following me again.
I was on a boat when I noticed they weren't following me anymore after travelling for a few minutes. And as of now they haven't re-spawned back and I believe it is because the chunks they're in were unloaded.