Since both cars are driving at the same speed, then they should pass the same distance at a given time.
Regardless the direction of the cars, the lines that represents the distances are equal.
Let car1 travels x mph from A to B
and car 2 travels x mph from C to D
Then after time (t) we note that:
AB = CD
The cars are in the same speed.
Speed indicates oly magnitude.
The lines the car travel are not indicated.
The cars may travel in the same line and direction . Then they keep the same distance between them.
The cars may travel in opposite direction in the same speed. They meet exactly half the way at a time , half inital the initial distance divided by the speed.
If the cars travel in different lines paralel to each other, then the situation similar as above.
If the cars travel at different lines(not parallel) , then the directions of their speed , the angle of inclination between the path of the lines the cars move are to be considered and the n only we can say about the relative distance of the cars on different lines.