Figured it out. Was missing a library so added the library so now
void leftMotorStop()
{
leftMotor.detach();
}
void rightMotorStop()
{
rightMotor.detach();
}
works. As the object moves into the minimum distance of 10cm, the servos stop. When the object moves farther than 10cm, the servos start. Now to work on moving backwards, turning right and left based on the Ping return distance. Thanks for the help so far!!!