Investigations have been performed on the dynamics of a distance regulation system based on an oscillating probe at resonance. This was examined at a tuning fork shear-force feedback system, which is used as a distance control mechanism in near-field scanning optical microscopy. In this form of microscopy, a tapered optical fiber is attached to the tuning fork and scanned over the sample surface to be imaged. Experiments were performed measuring both amplitude and phase of the oscillation of the tuning fork as a function of driving frequency and tip-sample distance. These experiments reveal that the resonance frequency of the tuning fork changes upon approaching the sample. Both the amplitude and the phase of the tuning fork can be used as distance control parameter in the feedback system. Using the amplitude a second-order behavior is observed, while with phase only a first-order behavior is observed. Numerical calculations confirm these observations. This first-order behavior results in an improved stability of the feedback system. As an example, a sample consisting of DNA strands on mica was imaged which showed the height of the DNA as 1.4 +/- 0.2 nm.