How I handle it:
1. I make it clear before the game starts what kind of game I'm running: Adult, teen, or clean fun. "Adult" game mean it has mature themes (movie rating R), "teen" game means it has violence, blood, and swearing (movie rating PG-13); "clean fun" means bloodless violence, no swearing, and is probably comedy-oriented. I don't run games for typical young children.
2. I make it clear before the game starts how to handle guests, kibitzers (guests who are interested in the game), or children: Notify the DM as early as possible, to expect a guest --> This is a requirement if you're going to play. Kibitzers are welcome and told before the game starts to please observe good manners and don't interrupt players or the DM. Children are given a quiet room with parent-provided toys; other players are cordially reminded that the parents/guardians may have to interrupt the game to deal with children, and this is no different than a work pager going off in the middle of combat because the primary server crashed - so Watch The Language.
3. Players who don't call the DM before bringing over uninvited guests get a private talking-to the next day, a reminder of what kind of game I run, and what is considered common courtesy at my gaming table. You see, that phone call before the game starts gives me (or the host, if it's not at my place) 30 minutes or so to set up an extra chair or make the guest room child-safe, make sure I have enough soda/juice/snacks for everyone, and so forth. Showing up on my doorstep with a surprise guest means that everyone else has to wait while I deal with the problem that someone rudely just dumped on me.
4. Repeat offenders get two warnings to get their act together and stop dumping their problems on everyone else at the table. If that doesn't fix it, then they get kicked out of the game. That does fix it.
5. Guests are expected to act as good guests. Guests who don't act as such are shown the door. Children are still learning how to be good guests, so the parents/guardian are given leeway... as they take their portable temper tantrum home.
I have had to kick one player from a game I ran for passing the two warnings stage when his best bud was visiting over one summer, years ago.