Robot not going perfectly straight

Hello all,
I have 2 DC mounted on a robot platform connected to a L298N (H-Bridge) and that to an Arduino Uno; for some reason with all my projects the robot does not go in a perfectly straight line when in reverse or forward. Even with a simple program that just makes the robot do a few maneuvers like forward, counter-clockwise turn, clockwise turn, and reverse it doesn't go in a perfect line for the forward and reverse portions (it goes in like an arc shape). I have attached the link to the website that i got the schematic and program from below. I have also pasted the code below for those of you how may not want to go to the link.

If anyone has an idea what the issue is I would really appreciate a reply.

//Motor A
const int motorPin1  = 9;  
const int motorPin2  = 10;
//Motor B
const int motorPin3  = 6;
const int motorPin4  = 5;

//This will run only one time.
void setup(){
 
    //Set pins as outputs
    pinMode(motorPin1, OUTPUT);
    pinMode(motorPin2, OUTPUT);
    pinMode(motorPin3, OUTPUT);
    pinMode(motorPin4, OUTPUT);
    
    //Motor Control - Motor A: motorPin1,motorpin2 & Motor B: motorpin3,motorpin4

    //This code  will turn Motor A clockwise for 2 sec.
    analogWrite(motorPin1, 180);
    analogWrite(motorPin2, 0);
    analogWrite(motorPin3, 180);
    analogWrite(motorPin4, 0);
    delay(5000); 
    //This code will turn Motor A counter-clockwise for 2 sec.
    analogWrite(motorPin1, 0);
    analogWrite(motorPin2, 180);
    analogWrite(motorPin3, 0);
    analogWrite(motorPin4, 180);
    delay(5000);
    
    //This code will turn Motor B clockwise for 2 sec.
    analogWrite(motorPin1, 0);
    analogWrite(motorPin2, 180);
    analogWrite(motorPin3, 180);
    analogWrite(motorPin4, 0);
    delay(1000); 
    //This code will turn Motor B counter-clockwise for 2 sec.
    analogWrite(motorPin1, 180);
    analogWrite(motorPin2, 0);
    analogWrite(motorPin3, 0);
    analogWrite(motorPin4, 180);
    delay(1000);    
    
    //And this code will stop motors
    analogWrite(motorPin1, 0);
    analogWrite(motorPin2, 0);
    analogWrite(motorPin3, 0);
    analogWrite(motorPin4, 0);
  
}

I've no great experience with robots, but since the program seems to very symmetric and apparently also, to some extent, works, I'd start suspecting mechanical or electrical problems and would start swapping components from left to right so see if the problem moves to the other side.
If the forward movement always tends to the left, then the transmission on the left side is not performing at the same rate as the transmission on the right.

A common problem with motors. Two seemingly identical motors having the same voltage applied to each will not turn at the same speed because of several mechanical and electrical differences, such as friction, brush wear, rotor balance, and on and on and on...
In order for your platform to travel a straight line you will need feedback from each motor so that motor speed can be determined. When the controller knows the speed of each motor it can make adjustments via PWM to each motor to keep them both at the same speed.
One method would be to establish a "set point" for a particular speed and let the controller adjust both motors to maintain that set point.