Bhagavad Gita, Chapter 2, Verse 64
But the self-controlled man, moving among objects with his senses restrained and free from attraction and aversion, attains peace.
You don't have to avoid the world entirely. You just can't let it grip you, either toward or away.
This isn't a call to withdraw from life. It's possible to actually engage with the world and still stay free, as long as the pull of liking and disliking isn't running the show underneath it.