In short most often "до" describes time sequence, while "перед" - space position (="in front of").

If "перед" is used for time sequence then it means "right before", "immediately before". If "до" is used for space position then it implies a kind of imaginary motion in some direction.