Legal risks: serious in theory, none in practice. Just don't leave your instance running unmonitored for months and make it moderately difficult for bots to sign up. There are tools to detect child porn and other such material but they require a GPU which makes hosting a server quite a lot more expensive. Just make sure there's a way to contact you in case of problematic material and you should be fine. Read up on your local laws about what's expected of you as a hosting provider if you're still in doubt, every country has its own requirements.
As for mental health, it depends on what kind of people you attract. A group of friends visiting normal communities brings barely any mental toll, open signups will have you spend time every week banning and blocking abusive accounts and filtering out borderline porn content.