Although most shows are self contained fictional worlds that exist separate from the rest of TV, there are some that actually connect to other shows in pretty unexpected ways.
Sometimes this happens due to the nature of spinoffs. The whole concept here is that the creators take a character from one show and give him his own series which takes place in the same world. So Frasier exists in the same fictional setting as Cheers, with plenty of overlapping characters, but not the same fictional setting as Friends. It's just like how Iron Man shares a universe with Captain America but not with Batman. In the Frasier universe, Sam Malone and Norm Peterson exist, but Joey Tribbiani doesn't.
Another way this can happen is through a crossover event, where two shows come together into one. Family Guy and American Dad had a fun crossover in one episode, so that means that Peter Griffin lives in the same world that Stan Smith inhabits. By doing this, the creators are implying this larger fictional universe that encompasses multiple shows, even if the crossover is mostly just for comedy purposes.
This is quite common on TV, though it's often so subtle that a lot of viewers don't even notice. Sometimes characters pop up in multiple shows as a way of connecting them all, while other times characters will reference products or events from another series.
Here are 10 shows you didn't even realise actually take place in the same universe.
10. A Whole Bunch Of TGIF Sitcoms
Here's a mind bender for you: half of the sitcoms you grew up watching, namely Family Matters, Perfect Strangers, Full House, Boy Meets World, and Step by Step all share the same universe. The thing connecting them? None other than Steve Urkel.
Yes, a whole bunch of shows airing on the TGIF programming block connect to one another and had funny little crossovers now and then. Starting with Perfect Strangers, Family Matters is actually a spinoff of that show, with Harriette Winslow first appearing as an elevator operator in seasons three and four. She then got her own series, which is what turned into Family Matters.
Family Matters quickly became the Steve Urkel show, and he showed up in a Full House episode called Stephanie Gets Framed, where he helps Stephanie deal with having to wear glasses. In the Boy Meets World episode Beauty and the Beast, Steve sends a chain letter to Cory and the two are apparently friends, though they don't interact on screen.
Then Steve also appears in Step by Step pretty brilliantly. At the end of a Family Matters episode, Steve flies on a jet pack through the roof of the Winslow house, and he lands in an episode of Step by Step, crashing in front of the Lambert-Foster family while they're on a picnic. Okay, that's awesome.