There’s two kinds of issues: instance and pattern. The first time or two, it’s instance. You deal with those with specificity. Something like, “I would prefer not to talk about this subject with you, please stop”.
If it persists, then it’s a pattern problem. You deal with the pattern, not the instance. “I’ve asked you not to talk about subjects like this in the pant, but you haven’t stopped. This makes me feel like you don’t respect my boundaries and it’s making it difficult for me to work with you. Why are you doing this to me?”.
You can escalate from there, and this might involve management involvement but at least you’ll have the clarity of having made the situation clear before it gets there.
Honestly though, unless the coworker is actually deranged, they’ll be mortified when they find out they are making you uncomfortable and they’ll stop right away.