It did not work out because the binding ideology wasn't pan-slavism, but rather bad mix of communism and socialism.
Also, instead of returning to our root slavic religion, we got atheism. Without any form of religion, people can not feel that deep bond. Especially Slavic people, who are naturaly very religious.
Yugoslavia was a mistake, but not for reasons you might think.