Problem with accelstepper library when controlling 2 steppers, 1st loop shorter

Hello,
This is my first time posting to this forum and I’m new to arduino as well.

I am trying to control two 28BYJ-48 unipolar stepper motors with drivers using the accelstepper library. The problem is that when I turn on my Arduino Uno the code starts but the 1st loop of the code is always shorter than the rest. This messes up my project and I would really like to know what I am doing wrong. I made an opening bridge model and the sides of the bridge are supposed to be lifted by strings connected to the motors on both sides (one motor for each side). The uneven loop length makes it so that the bridge is never flat. I have provided my code below. (I didn’t write this all by myself, most of it is from a YouTube video I watched on a similar subject.)

#include <AccelStepper.h>
#include <MultiStepper.h>

 
// Include the AccelStepper Library
#include <AccelStepper.h>
 
// Define Constants
 
// Define step constant
#define FULLSTEP 4

 
// Define Motor Pins (2 Motors used)
 
#define motorPin1  8     
#define motorPin2  9     
#define motorPin3  10    
#define motorPin4  11    
                        
                        
#define motorPin5  4    
#define motorPin6  5     
#define motorPin7  6     
#define motorPin8  7     
 
// Define two motor objects
// The sequence 1-3-2-4 is required for proper sequencing of 28BYJ48
AccelStepper stepper1(FULLSTEP,motorPin1, motorPin3, motorPin2, motorPin4);
AccelStepper stepper2(FULLSTEP,motorPin5, motorPin7, motorPin6, motorPin8);
 
void setup()
{
  
  // 1 revolution Motor 1 CW
  stepper1.setMaxSpeed(500.0);
  stepper1.setAcceleration(400.0);
  stepper1.setSpeed(300);
  stepper1.moveTo(-3500);  

  delay(3000);
  
  // 1 revolution Motor 2 CCW
  stepper2.setMaxSpeed(500.0);
  stepper2.setAcceleration(400.0);
  stepper2.setSpeed(300);
  stepper2.moveTo(3500); 

 delay(3000);
}
 
 
void loop()
{
  //Change direction at the limits
  if (stepper1.distanceToGo() == 0) 
    stepper1.moveTo(-stepper1.currentPosition());
    
  if (stepper2.distanceToGo() == 0) 
    stepper2.moveTo(-stepper2.currentPosition());
    
  
  stepper1.run();
  stepper2.run();
 
}

I appreciate any advice or information anyone is willing to provide.

Thanks in advance.

but the 1st loop of the code is always shorter than the rest.

The loop() function contains no looping statements, so it really isn't clear what loops you are talking about.

My guess is that you should not be changing the position of either motor unless the distance to go for both motors is zero.,