But it would've been better if you hadn't used the brakes (unless there was a ton of traffic in front of you). Why? It's all in physics.
If the car is able to actually move when being hit, the force of the impact is spread out over a longer period of time (a few more seconds makes a big difference), so the damage is a lot less and your whiplash isn't as bad.