This is why a lot of content is hosted on large platforms that handle this risk for you. But if you don't collect any personal data on those users your exposure is minimal but technically some jurisdiction could claim you allowed access to "illegal content" under their law.
Most of these jurisdictions can't actually do anything about it, but they can claim they will. The UK might actually be in this situation.