There are certain topics that are uncomfortable to discuss with coworkers, like politics or personal values, but that doesn't stop people from bringing them up. Here's a phrase you should use to easily redirect the conversation back to work appropriate chat.
Whether you're trying to avoid a specific topic, or you just need to get a chatty colleague to answer your work related question, saying "This is an important conversation, but can we talk about it after X?" puts the focus back on work while still acknowledging what your coworker was saying.
Of course, you can tweak that phrase to match the situation or your personality. For example, try making it a statement rather than a question or replacing "important conversation" with "interesting idea". Soften the redirection by adding a way for them to reconnect with you on the topic, assuming you're OK talking about it.
However you end up customising it, the point is that you let your colleague feel heard without having to go too deep into an uncomfortable discussion.