No, because they don't count as NPCs
In short, familiars and animal companions do not take a share of XP because, being under a player's control rather than the DM, they do not count as NPCs. (The fact that they're acquired by a class ability is irrelevant to whether or not they gain XP; there is no rule to this effect in D&D 5th edition.)
As the question says, the rules on who gains XP are in clearly defined in the Dungeon Master's Guide, p.260:
When adventurers defeat one or more monsters—typically by killing, routing or capturing them—they divide the total XP value of the monsters evenly among themselves. If the party received substantial assistance from one or more NPCs, count those NPCs as party members when dividing up the XP.
Only adventurers and NPCs gain XP. Here's why familiars and animal companions count as neither of those:
1. They're not NPCs because the DM doesn't control them
NPC is clearly defined in the Player's Handbook, p.89:
A nonplayer character is any character controlled by the Dungeon Master. NPCs can be enemies or allies, regular folk or named monsters.
The ranger's animal companion is controlled by the player, not the DM:
The beast obeys your commands as best it can. It takes its turn on your initiative, though it doesn't take an action unless you command it to.
A familiar is also under the player's control (PHB 240):
Your familiar acts independently of you, but it always obeys your commands.
2. They're not adventurers because they don't have class levels
"Adventurer" is clearly defined as someone with class levels (PHB 11):
Every adventurer is a member of a class.
"Party" is clearly defined as a group of adventurers:
Each character plays a role within a party, a group of adventurers working together for a common purpose.
Animal compansions and familiars do not have class levels. They therefore don't count as adventurers or party members. Since they're not NPCs either, they do not take a share of XP or gain XP.