Change speed and position stepper motor in ARDUINO

I am trying to move a certain distance from the motor step by step with a specific speed when i press a button. I am moving the distance without problem, but I cannot change the speed. I tried with the following instructions

MOTOR.setseped (speed)
MOTOR.move(DRIVER_PASOS);

and

speed()
MOTOR.move(DRIVER_PASOS);

The motor always move the distance correctly but with a default speed

some suggestions of how I can do it?

Which stepper library are you using ?

Please post a complete program that shows the problem

AccelStepper MOTOR(AccelStepper::DRIVER, DRIVER_PULL_PIN, DRIVER_DIR_PIN);

if ( INTERRUPCION_DOMO_ == 0) {
if ( PASOS == 0) {
if (DIR_MOTOR > LOW ) {
DRIVER_DIR = 1;
MOTOR.setSpeed(DRIVER_RPM * -1);
}
else {
DRIVER_DIR = 0;
MOTOR.setSpeed(DRIVER_RPM);
}
} else {
if (DIR_MOTOR > LOW ) {
DRIVER_DIR = 1;

MOTOR.move(DRIVER_PASOS * -1);
}
else {
DRIVER_DIR = 0;

MOTOR.move(DRIVER_PASOS);
}

}
}

Please post a complete program that shows the problem