Do you mean when you hold the brake down while moving, or holding the brake down while not moving?
Does "have the D in" mean you have it in the regular Drive gear?
My first two guesses would be that you have a transfer case speed sensor problem, indicating mismatched axle speeds, or that you have a mismatched tire diameter between the front and rear so it is really sensing a difference in axle speeds. Is this only happening on slick surfaces where there may be wheels slipping when the brakes are applied?
I'm wondering if what you are feeling is just the 4WD continuously engaging, disengaging, and engaging again because the system thinks you are losing traction.
Does your vehicle have the stability control feature? If so, (and I could be wrong) then it may depend on the ABS wheel speed sensors at each of the wheels and a bad ABS signal from any, could trigger stability control to kick in? I would want a scan tool capable of Ford-specific trouble codes, to see if any codes are set and to monitor the speed sensors when this happens.