We report measurements of noncontact friction between surfaces of NbSe$_{2}$ and SrTiO$_{3}$, and a sharp Pt-Ir tip that is oscillated laterally by a quartz tuning fork cantilever. At 4.2 K, the friction coefficients on both the metallic and insulating materials show a giant maximum at the tip-surface distance of several nanometers. The maximum is strongly correlated with an increase in the spring constant of the cantilever. These features can be understood phenomenologically by a distance-dependent relaxation mechanism with distributed time scales.