For polynomial expressions @Buddha_the_Scientist's suggestion `Variables` will work. For more general expressions

    expr = x^2 + y^3 + z
    DeleteDuplicates@Cases[expr, _Symbol, \[Infinity]]

Should do the trick in most situations.