Maher-shalal-hash-baz (Baz for short) is Ned Flanders' pet dog.
Shortly later in the episode, however, Baz came over to the Simpsons' house and started pawing at the door. Homer opened it and Baz ran into the house, running around and playing with him.
Homer chose to play with her too. Santa's Little Helper saw this and became very jealous. Eventually, Baz started spending way more time with Homer than with Ned and started to like him better.
Eventually, Ned finally realized that Baz liked Homer better and, with great misery, gave her up to Homer. Homer didn't want to have Baz if Ned was going to be so sad without her and so he gave her back to Ned. Baz started liking Ned again without explanation. At the end, Baz came back to the Simpsons' house again and went to see Santa's Little Helper.
Santa's Little Helper was ticked off to see her there, but then, they started playing around and having fun as buddies.