In practice, the codes you find floating around the internet for a free pet in MCWorld don't actually work. Most are outdated, fake, or simply bait.
Your best bet is to obtain pets through the game's official features rather than chasing codes that promise something they can't deliver.