Bernstein spectral method for quasinormal modes and other eigenvalue problems