Passive Radar platform using Stepper and Rotary encoder

Alright, I attempted a different approach with a custom code to utilize the encoder for readout and control of the stepper. However, I encountered a persistent issue: when attempting to read out the encoder independently, I received unintelligible serial output.

The stepper successfully completes its 8000 steps, but without utilizing an interrupt and disregarding the encoder, it continues rotating until all 8000 steps are completed. Subsequently, upon completing the steps, the serial output starts displaying nonsensical characters. Despite searching various forums, I haven't found a solution or guidance on resolving this issue.

Could the problem lie in my encoder connection? Furthermore, how can I enhance the encoder's functionality to ensure the stepper halts precisely at the midpoint of its 8000-step rotation when it reaches its maximum or minimum value?

#include <Stepper.h>
#include <Encoder.h>

#define ENC_A 2
#define ENC_B 3

#define min_encoder_value -1000
#define max_encoder_value 1000

Encoder encoder(ENC_A, ENC_B);

// Define number of steps per revolution:
const int stepsPerRevolution = 200;

#define pwmA 3
#define pwmB 11
#define brakeA 9
#define brakeB 8
#define dirA 12
#define dirB 13

// Initialize the stepper library on the motor shield:
Stepper myStepper = Stepper(stepsPerRevolution, dirA, dirB);

void setup() {
  // Set the PWM and brake pins so that the direction pins can be used to control the motor:
  pinMode(pwmA, OUTPUT);
  pinMode(pwmB, OUTPUT);
  pinMode(brakeA, OUTPUT);
  pinMode(brakeB, OUTPUT);

  digitalWrite(pwmA, HIGH);
  digitalWrite(pwmB, HIGH);
  digitalWrite(brakeA, LOW);
  digitalWrite(brakeB, LOW);

  // Set the motor speed (RPMs):
  myStepper.setSpeed(30);

  Serial.begin(9600);
}

void loop() {
  long encoderValue = encoder.read();

  Serial.println(encoderValue);

  if (encoderValue >= max_encoder_value) {
    myStepper.step(-8000);
  } else if (encoderValue >= min_encoder_value) {
    myStepper.step(8000);
  }
}

I appreciate any assistance in advance.