People can (and do) sue, but they lose every time because it's easy for their well resourced corporate legal team to prove the show is (obviously) parody and thus, protected free speech.
Simple answer is they are careful about what they say and have good lawyers that review it.
A few examples.
Calling Tom Cruise a fudge packer in the context of him being in a bathhouse could eaisly open them up to liability for calling him gay. But doing it in a fudge factory while showing him putting fudge in a box gives them a clear defense that they meant it literally.
Simmaraly telling him to come out of the closet while he is actually in a closet provides cover.
Making things so absurd that a reasonable person wouldn't believe it and know it's a joke also works. So having Barbara Streisand aquire an artifact that makes her into a giant robot monster works but something plausible wouldn't.
Having Kanye open up and admit he is a gay fish is absurd enough to provide protection. However they probably couldn't get away with him simply coming out as gay.
Of course the genius of south park is they use these legal protections in ways that make the story funnier and not just for cover.
They do get sued pretty often, but the law is on their side. The more absurd the circuimstances the easier it is to get away with as Parody, the only time you're in hot water is if the viewers in any sizable metric would be fooled into thinking the things portrayed in the show were true when in reality they weren't. In fact, when South Park revealed everything about Scientology's internal beliefs they were almost sued but Scientology backed down because what South Park said in the episode was actually verifiable truths that could be backed up with evidence in court.
It's a very fine line they would have to walk. It must be believable to the average person that the claims are true. It must not actually be true. It must be done with (the appearance of) malice. It must not be done as a criticism/satire of the target and their actions.
And on top of that, their publicist/PR must think a lawsuit will get them more than they lose. Once it's aired, it is out there forever. It could then be the one that everyone seeks out and shares with friends, as "the one that Tom Cruise sued to get rid of". This is known as "The Streisand Effect".
As others have pointed out, US first amendment laws generally protect shows like South Park because it's generally understood that the characters in the show that resemble real people are parodies, and the show runners aren't stating a fact that the real person said or did a thing in reality.
Funnily enough, the UK has much stricter laws about defaming people - the country has a strict class system, and it wouldn't do if poor people could embarrass rich people - there is a significant carve out for "vulgar abuse". If I was to go on TV and (for sake of example) called Boris Johnson three shit-stained jugs of fetted piss wearing a trench coat, that would be ok, because people understand that to be a euphemistic insult, not a literal statement of fact. If I went on TV and said that he was a drunk, that wouldn't be - unless I can prove that he is an alcoholic, he could sue me for libel. The outcome of this is that an equivalent show to South Park could be made in the UK, it would just have to be utterly filthy
Hijacking this, but, do people actually watch south park? My friend showed me a couple episodes, one was about cartman having a kanye on his shoulder that made him antisemitic, and the whole episode was pretty stupid. Also showed me a... parody? Of multiverse stuff, maybe? Had some sort of willy wonka figure and imaginationland and a bunch of off brand characters, and then they all died in a big war, that one was pretty stupid. Also showed me a one about the being evil and killing jesus on christmas, or something like that, which was also pretty stupid. Other friend showed me a dog the bounty hunter parody, also struck me as pretty stupid. They were all just really dumb, there was nothing really insightful about any of this subject matter in particular, it was just like I was watching whatever they were making satire of, but if it was decroded by like a couple IQ medians.
I dunno, most other adult-oriented animated comedies are also pretty bad and hacky, and also feel the need, a lot of the time, and especially in their "cultural commentary" episodes, to have something at the end which ties everything into a takeaway for the viewer, totally unironically. Like a children's book that needs to have a moral or message. In south park, it's always an extremely writer's-POV here's your takeaway "I am talking directly to the audience", kind of way, which I find, just straight up pretty bad most of the time. I dunno, I really don't understand how people watch this shit. It's like a show that would come on inside of some other show as a shorthand that the people watching it are really dumb.