I've got a problem combining two codes !! help please

Hello all i have a problem in my project, i have in my arduino uno a sensor linked to an lcd , when the sensor detects an obstacle it successfully shows “goal” as you see in my code “code1” and everything is working good, and i linked a servo motor to the UNO and when i import this the code of the servo “code2” the servo works perfectly but when i put it in the final code (both combined) as you see in “code 3” the servo is not working anymore and the lcd + sensor are working but the sensor becomes slow
and these are my codes
code1 (sensor+lcd)

 #include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 30;

int ledPin = 13;                // choose the pin for the LED
int inputPin = A0;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  Serial.begin(9600);
  lcd.begin(16,2);  //lcd
  
  Serial.print("calibrating sensor ");
    lcd.setCursor(0,0);  
    lcd.print("   WELCOME IN   ");
    lcd.setCursor(0,1);
    lcd.print(" ALLIANZ ARENA ");
    delay(300);
  for(int i = 0; i < calibrationTime; i++){
    Serial.print(".");
    delay(1000);
  } 
}

void loop(){
 
  val = digitalRead(inputPin);  // read input value
  Serial.println(val);
  if (val == HIGH) { // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    delay(150);

    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
        lcd.setCursor(0,0);  
    lcd.print("   GOOOOOOAL    ");
    lcd.setCursor(0,1);
    lcd.print("NICE SHOT PLYAER");
    delay(300);
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    delay(300);
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
        lcd.setCursor(0,0);  
        lcd.print("    NO  GOAL    ");
        lcd.setCursor(0,1);
        lcd.print("NICE TRY PLAYER!");
        delay(50);
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
   
}

“code2” (only servo)

#include <Servo.h>

Servo myservo;  

int pos = 0;    

void setup() {
 
  myservo.attach(9);  //servo
  
}

void loop() {

  
  for (pos = 0; pos <= 180; pos += 1) { 
    // in steps of 1 degree
    myservo.write(pos);             
    delay(15);                       
  }
  for (pos = 180; pos >= 0; pos -= 1) { 
    myservo.write(pos);              
    delay(15);                       
  }
 

}

“code3” when i combine them (not woking)

#include <Servo.h>
int pos = 0;
Servo myservo; 
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 30;

int ledPin = 13;                // choose the pin for the LED
int inputPin = A0;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  Serial.begin(9600);
  lcd.begin(16,2);  //lcd
  
  Serial.print("calibrating sensor ");
    lcd.setCursor(0,0);  
    lcd.print("   WELCOME IN   ");
    lcd.setCursor(0,1);
    lcd.print(" ALLIANZ ARENA ");
    delay(300);
  for(int i = 0; i < calibrationTime; i++){
    Serial.print(".");
    delay(1000);
  }
  {
    myservo.attach(9);  //servo
  }
}

void loop(){
 
  val = digitalRead(inputPin);  // read input value
  Serial.println(val);
  if (val == HIGH) { // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    delay(150);

    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
        lcd.setCursor(0,0);  
    lcd.print("   GOOOOOOAL    ");
    lcd.setCursor(0,1);
    lcd.print("NICE SHOT PLYAER");
    delay(300);
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    delay(300);
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
        lcd.setCursor(0,0);  
        lcd.print("    NO  GOAL    ");
        lcd.setCursor(0,1);
        lcd.print("NICE TRY PLAYER!");
        delay(50);
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
  {
      for (pos = 0; pos <= 180; pos += 1) { 
    // in steps of 1 degree
    myservo.write(pos);             
    delay(15);                       
  }
  for (pos = 180; pos >= 0; pos -= 1) { 
    myservo.write(pos);              
    delay(15);                       
  } 
  }
}

thank you for helping me <3

Try to understand the BlinkWithoutDelay example, then remove all delay() from your code.

i deleted all the delay of the code and i keeped the delay of the servo and it works good thank you so much, u saved my project <3