Iterations From an IR Sensor

I created a robot vehicle that will follow black tape with a couple IR sensors. At certain locations of this "track" there are strips of black tape that are perpendicular to the direction the vehicle moves. There is an additional sensor on the vehicle to detect these strips of tape. At specific locations of the strips, the robot will have to perform a specific task (ie. it will pick something up at location 1 and will drop it off at location 3).

Can someone give a recommendation to go about this? The best I can think of is for each time that sensor detects tape, it performs an iteration. Depending on the iteration, the robot will perform a specified task. I end up having lots and lots of if statements and everything is pretty messy. Can I do something with for loops, while loops, or switch statements that might clean this up?

Also when it detects the tape, stops and performs task, and starts moving again, it iterates twice. Where should I have a delay?

if(i==0){
    i=i+1;
    Serial.print(i);
    digitalWrite(pasp, LOW);  // motor stops
    digitalWrite(drip, LOW);   // motor stops
    digitalWrite(drin, LOW);   // motor stops
    digitalWrite(pasn, LOW);  // motor stops
    servo.write(1);  // robot arm moves into place
    delay(1000);
    gripper.write(180);         // robot arm closes
    delay(2000);
    servo.write(90);  // robot arm moves back to home position
    delay(500);
    analogWrite(passpeed, 100);  // passenger wheel speed
    analogWrite(drispeed, 100);   // driver wheel speed
    digitalWrite(pasp, HIGH);    // motor starts forward
    digitalWrite(drip, HIGH);     // motor starts forward
    digitalWrite(drin, LOW);   
    digitalWrite(pasn, LOW);
    delay(2000);
   }