NEED HELP vibration sensor and keypad fucntion

hi friend.
i have 1 project is name “SAFE BOX”. this project have vibration sensor SW-420 NC TYPE VIBRATION SENSOR to detect any vibration if some one try to open or hack by hammer.
i use also keypad and magnetic lock to open/close door.
i try combine vibration sensor coding with keypad coding but not 100% work. vibration sensor work fine can detect vibration and trigger buzzer but keypad like delay a few second every time i press keypad ( i must wait 3 or 4 sec to enter password 1 by 1 ).
can any one help check my coding?

#include <Password.h> 
#include <Keypad.h> 
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);  // 0x27 or 39 or 0x3F
// SDA = A4 SCL = A5

Password password = Password( "1234" ); //password to unlock, can be changed
//Password password1 = Password( "232" ); //password to unlock, can be changed
//Password password2 = Password( "231" ); //password to unlock, can be changed
int cycle = 0;  // set cycle to 0
int bz = 11;  // buzzer
int lock = 12;  // relay for lock/unlock door
int sensor = 24;  // vibration sensor
int red = 22;  // led red for lock
int green = 23;  // led green for  unlock
const byte ROWS = 4; // Four rows
const byte COLS = 4; // columns

// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

// byte for symblo lock
byte locked[8] = { B01110,
                    B01010,
                    B01010, 
                    B01010, 
                    B11111, 
                    B11111, 
                    B11111, 
                    B00000, }; 

// byte for symblo unlock                    
byte unlocked[8] = { B01110, 
                     B01010, 
                     B00010, 
                     B00010, 
                     B11111, 
                     B11111, 
                     B11111, 
                     B00000, };
                                     
              
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 9, 8, 7, 6 };// Connect keypad start from left to right
byte colPins[COLS] = { 5, 4, 3, 2 };


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );



void setup()
{
  
  lcd.init();
  lcd.createChar(0, locked);
  lcd.createChar(1, unlocked);
  lcd.backlight();            
  lcd.begin(16, 2); 
  lcd.setCursor(0,0);
  lcd.print("Safe box "); // wellcome note
  //lcd.print(" ");
  lcd.setCursor(1,1);
  lcd.print("XXXX XXXX");
  delay(3000);
  lcd.clear();  // clear display
  Serial.begin(9600);
 // Serial.write(254);
  Serial.write(0x01);
  delay(200); 
  pinMode(bz, OUTPUT);  // set buzzer as output
  pinMode(lock, OUTPUT);  // set relay as output
  pinMode(sensor, INPUT);  // set relay as output
  pinMode(red, OUTPUT);  // set red led as output
  pinMode(green, OUTPUT);  // set green led as output
 
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad

  digitalWrite(lock, LOW);// to sure door always lock
  digitalWrite(red, HIGH);
  digitalWrite(green, LOW);
  }

void loop()
{
  lcd.backlight();
 long measurement =TP_init();  // vibration sensor
  delay(10);
  Serial.print("measurment = ");
  Serial.println(measurement);
  if (measurement > 100){ // set point to trigger
   digitalWrite(bz, HIGH);
    delay(1000);
    digitalWrite(bz, LOW); 
 
  }
  else{
    digitalWrite(bz, LOW); 
     keypad.getKey(); // keypad fucnction
  lcd.setCursor(0,1);
  lcd.print("Door Lock... ");
  lcd.setCursor(14,1);
  lcd.write((byte)0);
  }
  }
//vibration sensor measurement
long TP_init(){
  delay(10);
  long measurement=pulseIn (sensor, HIGH);  //wait for the pin to get HIGH and returns measurement
  return measurement;
}
  
  //take care of some special events
  void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
  case PRESSED:
  
   digitalWrite(bz, HIGH); //turn on
   delay(50); //wait 5 seconds
   digitalWrite(bz, LOW); //turn on
   delay(50); //wait 5 seconds
  lcd.setCursor(0,0);
  lcd.print("Enter: ");
  lcd.setCursor(6,0);
  lcd.print(eKey);
  lcd.setCursor(0,1);
  lcd.print("Door Lock... ");
  
  
  Serial.print("Enter:");
  Serial.println(eKey);
  delay(10);
  
 // Serial.write(254);
  
  switch (eKey){
    case '*': checkPassword(); delay(1); break;
    
   // case '#': password.reset(); delay(1); break;
    
     default: password.append(eKey); delay(1);
      
}
}

}


void checkPassword(){
  
if (password.evaluate()){  //if password is right open

    
    Serial.println("Accepted");
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Accepted");
    lcd.setCursor(0,1);
    lcd.print("Door Open....");
    lcd.setCursor(14,1);
    lcd.write((byte)1); // symbol unlock
    digitalWrite(lock, HIGH);//door open 
    digitalWrite(red, LOW);
    digitalWrite(green, HIGH); 
    digitalWrite(bz, HIGH);//turn on
    delay(300); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    delay(5000); //wait 5 seconds
    digitalWrite(lock, LOW);//door lock
    digitalWrite(red, HIGH);
    digitalWrite(green, LOW);   
    cycle = 0;
    password.reset();
    lcd.clear(); 
    
}
else if (cycle == 2){  //if password wrong for 3 time
    
    Serial.println("Alarm");
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("Alarm");
    delay(200); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    digitalWrite(bz, HIGH);//turn on
    delay(1000); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    delay(500); //wait 5 seconds
    digitalWrite(bz, HIGH);//turn on
    delay(1000); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    delay(500); //wait 5 seconds
    digitalWrite(bz, HIGH);//turn on
    delay(1000); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    delay(500); //wait 5 seconds
    digitalWrite(bz, HIGH);//turn on
    delay(1000); //wait 5 seconds
    digitalWrite(bz, LOW);// turn off
    delay(500); //wait 5 seconds
    cycle = 0;
    password.reset();
    lcd.clear(); 
}
else{
    Serial.println("Denied"); //if passwords wrong keep locked
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Denied");
    lcd.setCursor(0,1);
    lcd.print("Door Lock... ");
  
    digitalWrite(bz, HIGH); //turn on
    delay(400); //wait 5 seconds
    digitalWrite(bz, LOW);//turn off
    delay(100); //wait 5 seconds
    digitalWrite(bz, HIGH); //turn on
    delay(400); //wait 5 seconds
    digitalWrite(bz, LOW);//turn off
    cycle++;
    password.reset();
    lcd.clear(); 
}

}
     keypad.getKey(); // keypad fucnction

It is pointless to call a function that ONLY returns a value, if you don't care what the value is.

long TP_init(){
  delay(10);
  long measurement=pulseIn (sensor, HIGH);  //wait for the pin to get HIGH and returns measurement
  return measurement;
}

This is a stupid name for a function that does not initialize anything. delay() is a blocking function, and is COMPLETELY unnecessary. pulseIn() is a blocking function.

Along with the delay() on EVERY pass through loop(), and the call to this function, on EVERY pass through loop(), of course it is going to take a while to recognize key presses.

I don't know what kind of vibration sensor you are using, but it is almost certainly not intended to be read as a digital device.