Stepper motor speed control by encoder

You have not told us what actually happens when you run your program.

You don't seem to have any Serial.print() statements in your program that would allow you to see if the encoder movements are being properly detected.

My wild guess is that the problem lies with the standard Stepper library because it blocks the Arduino from doing anything else until all the steps are complete. If that is the problem either try moving the motor one step at a time with your program controlling the interval between steps or look at the more comprehensive AccelStepper library

...R
Stepper Motor Basics
Simple Stepper Code