I think motor.move_relative() is the correct function to use. However, you will need to call it only once before staring of the loop.
Motors C++ API — PROS for V5 3.8.0 documentation
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.
int targetPosition = motor1.get_position() + inches;
motor1.move_relative(inches,speed);
while( fabs(motor1.get_position()-targetPosition)>3 )
pros::delay(10);
Since motors may stop not exactly at target position, you will need to figure out what distance around the target is ok to stop at. I set it to +/-3.
Also, it is best to use an average of positions of the motors on the left and right side of the robot, instead of relying on a single motor encoder.