3D spin glass and 2D ferromagnetic XY model: a comparison