Spectral representation of some weighted Hankel matrices and orthogonal polynomials from the Askey scheme