https://pros.cs.purdue.edu/v5/api/cpp/motors.html#move-relative
This function simply sets the target for the motor, it does not block program execution until the movement finishes. The example code shows how to block until a movement is finished.
What you need is something like this:
void Drive(double distance, int speed)
{
leftFront. move_relative(distance, speed);
rightFront.move_relative(distance, speed);
leftBack. move_relative(distance, speed);
rightBack. move_relative(distance, speed);
while(1)
{
double avgPos = (
leftFront. get_position() +
rightFront.get_position() +
leftBack. get_position() +
rightBack. get_position() ) / 4.0;
if( fabs(avgPos-distance)<5.0 ) break;
pros::delay(2);
}
}