Display message on LCD while sensors reads data over thresholds

Hi!
I still have a little work to do on this project (thanks to those who helped me, if they still see this topic).
This project has two states: ON - Alarm Activated appears on the LCD and the sensors read values; OFF - system outputs are off or standby. I tried to display another message in the ON state e.g. Potential Fire when the sensors read values above the set thresholds, and then when the values fall below the thresholds the Alarm Activated message reappears. So far I have only managed to display the message Potential Fire but the LCD flickers or the message Alarm Activated no longer appears.
What solution do you propose?

#include <Wire.h> 
#include <LiquidCrystal_I2C.h> 
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 

const int buttonPin = 2; 
int buttonState = 0;        
int lastButtonState = 0;     

int Buzzer = 7;
int Relay = 8; 

int flame = A0; 
int flameThershold = 900;  
int flame_val = 0; 

int gas = A1; 
int gasThreshold = 800; 
int gas_val = 0; 

bool flag = false; 
const long interval = 5000; 

void setup() {
  Serial.begin(9600);
  pinMode(flame,INPUT); 
  pinMode(gas, INPUT); 
  pinMode(Buzzer, OUTPUT); 
  pinMode(Relay, OUTPUT); 
  pinMode(buttonPin, INPUT); 
  lcd.begin(16,2); 
  lcd.clear(); 
  lcd.setCursor(0,0); 
  lcd.print("Fire Alarm"); 
} // void setup

void loop() {

  buttonState = digitalRead(buttonPin); 
  if (buttonState != lastButtonState) {
    if (buttonState == LOW) { // press the button to deactivate the alarm
      if (flag){
          lcd.clear(); 
          lcd.setCursor(0,0);
          lcd.print("Alarm "); 
          lcd.setCursor(0,1);
          lcd.print("deactivated");
          flag = false;
          delay(500);
      }
        else { // alarm is activated and shows up on the LCD
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Alarm activated");
          flag = true; 
          delay(500);
        }
     }
      delay(50); 
 }  
  lastButtonState = buttonState;
  if(flag){ // call Detect function
    Detect(); 
  }
} // void loop

void Detect(){ 
  flame_val = analogRead(flame); 
  gas_val = analogRead(gas); 
      Serial.print("Gas Level: "); // just some prints
      Serial.print(gas_val, DEC);
      Serial.print("    ");
      Serial.print("Flame Level: "); 
      Serial.println(flame_val);//Print the value to serial port
      Serial.println();  // output and display the analog value 
      // bool active;
  if ( (gas_val >= gasThreshold)||(flame_val >= flameThershold) ) // if sensors reads anything greater than thresholds
  { 	/* here i want to write a message on LCD e.g. Potential Fire!,  while the reads are greater than thresholds*/
        digitalWrite(Buzzer, HIGH); // turn on the buzzer
        delay(interval); // wait a few seconds
        digitalWrite(Relay, HIGH); // and turn the relay on
        // active = true;
  }
    else if ((gas_val < gasThreshold) && (flame_val < flameThershold)) {
	/*  if the values are less than thresholds then keep the buzzer and relay off*/
          digitalWrite(Buzzer, LOW);
          digitalWrite(Relay, LOW);
	/* after the values goes below the thresholds it LCD will display the last message e.g. Alarm activated */
        /*if (active == true) {
            lcd.clear();
            lcd.print("Potential Fire!");
            }
            else if (active == false) {
              lcd.clear();
              lcd.print("Alarm Activated");
              } */
          // active = false;
          }
} // Detect