I want to know whether the height I calculated by this method is the distance to the earth’s surface or the distance to the center of the earth

It’s the height above the WGS84 ellipsoid. If you want the distance to the center of the Earth, get the ECEF X,Y,Z coordinates instead and compute the magnitude of that vector.

Thanks for your answer