Spectral problems on arbitrary open subsets of R n involving the distance to the boundary