Ugh, I know exactly what you mean! I hope to become better at simply being frank and setting boundaries. Seriously, I just met you and you tell me your mom just died? OK, that is terrible, of course, but what the actual fuck, I'd almost go so far as to call that borderline abusive.
Then the guy next to me at this one job I had. Complaining the whole day. Every day. And you know what? I think it's my fault. I just let people like that use me as an emotional trashbin. If I were there now I'd definitely do something about it.
It's incredibly hard to overcome that behavior. I can recommend martial arts, since it allows you to process these behaviors and related emotions physically. Sounds a bit silly but my god you know exactly where your thresholds are and not to hesitate to hold your stand and how you're gonna do it.
You can't get rid of that one toxic person. They'll always be there in every group. The stoics wrote about it thousands of years ago, that it is our fate and we can only learn to handle it.
You should hang a flat earth poster or something just for the fun of it.