Sitcom crossovers don't usually present an issue with the shows involved, but casting quirks can cause problems when two or more series are joined together. Showrunners can create strong working relationships with certain actors, often wanting them to appear in many of their projects. However, some casting choices can affect continuity. Moving a character from one show to another needs to be considered carefully. Otherwise, the world of both shows can become compromised, as some references can go far beyond a subtle wink to the audience.
https://screenrant.com/scrubs-cougar-town-sam-lloyd-ted-lawyer-character/