The way it's normally used, the time dilation formula is only meant to apply when you have two events which happen at the same location but different times in one frame, and you want to know the time between them in another frame. And the length contraction formula isn't even meant to give you the distance between the same two events in different frames, instead it tells you that if you look at the distance L between two events representing the position of the front and back of an object "at the same moment" in its own rest frame, then if you want to know the distance l between two events representing the position of the front and back of the object "at the same moment" in a different frame (since the frames disagree about simultaneity, these can't be the same two events), the relation between the distances is given by l = L/gamma.