skipping state problem with interrupt

My problem is that this code sometimes works exactly like I want it to and jumps from state 0 to state 4 to alarmsetstate 0 -> alarmsetstate 1 -> alarmsetstate 2. But sometimes it jumps over certain states and I can't figure out why.
The interrupt is set to trigger when rising, how is it then possible that it skipes a state while only being pressed once?

Another problem is that after some time the program gets stuck when the display is showin on or off (alarmsetstate 2).

Does anybody know how I can resolve these two problems.
I'm just starting with arduino coding and am quite a noob, so please be gentle.
Thanks in advance for your help.

#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

int state = 0;
int alarmsetstate = 0;
int Button1 = 2;      
int Button2 = 3;

int h = 7;                //standard alarm time hour
int m = 30;               //standard alarm time minutes
int alarmstartm = 0;          //minutes variable for beginning increase light
int alarmstarth = 7;          //hours variable for beginning increase light
int alarm = 0;
int alarmlength = 30;         //amount of minutes in advance of real alarm time
int delaytime = 200;

void setup() {
   pinMode(Button1,INPUT);
   pinMode(Button2,INPUT);
   attachInterrupt(digitalPinToInterrupt(2),setAlarm,RISING);
   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
   Serial.begin(9600);
   
}

void loop() {
     if(state==0)                                     //Display time
   {
      display.clearDisplay();
      display.setTextSize(4);
      display.setTextColor(WHITE);
      display.setCursor(0,0);      
      display.print("TIME");      
      display.display();
   }
  
   else if(state==4){                                     //Set alarm time
    if(alarmsetstate==0){                                 // Set hours  
      display.clearDisplay();
      display.setTextSize(4);
      display.setTextColor(WHITE);
      display.setCursor(0,0);
      display.print(h);
      display.print(":");
      display.print(m);           
      display.display();                          
      if(digitalRead(Button2)==1){                        //Set hours of alarm
        h=h+1;                                            //increase by 1 hour
        if(h==24){                                        //if its 24 hour reset hour to 0
          h=0;
        }
        delay(delaytime);                    
      }      
    }
    else if(alarmsetstate==1){                            // Set minutes     
      display.clearDisplay();
      display.setTextSize(4);
      display.setTextColor(WHITE);
      display.setCursor(0,0);
      display.print(h);
      display.print(":");
      display.print(m);       
      display.display();
      if(digitalRead(Button2)==1){                        //Set minutes of alarm
        m=m+5;                                            //increase alarmtime by 5 min
        if(m==60){                                        // if min equals 60 reset to zero
          m=0;
        }         
        delay(delaytime);                    
      }
    }
    else if(alarmsetstate==2){                            // Set if alarm is ON or OFF      
      display.clearDisplay();
      display.setTextSize(4);
      display.setTextColor(WHITE);
      display.setCursor(0,0);
      if(alarm==1){
        display.print("ON");
      }
      else{ 
        display.print("OFF");          
      }
      display.display();      
      if(digitalRead(Button2)==1){                      
        if(alarm==1){alarm = 0;}
        else{alarm = 1;}           
        delay(delaytime);        
      }     
    }         
    else{                                                  // If alarmsetstate doesn't equal one of the declared values
     display.clearDisplay();
      display.setTextSize(1);
      display.setTextColor(WHITE);
      display.setCursor(0,0);
      display.println("E:alarmstate= ");
      display.print(alarmsetstate);         
      display.display();
   }
   }
   else if(state==5){
      alarmstartm = m - alarmlength;                         //Begin alarmlengt earlier than setalarm
      alarmstarth = h;
      if(alarmstartm<0){                                      //if alarmstart is less than 0 set 1 hour back 
        alarmstartm = 60 + alarmstartm;
        alarmstarth = alarmstarth - 1;
      }              
      alarmsetstate=0;                                       //reset alarmsetstate to zero
      state = 0;                                              //Go back to displaying current time (state 0)
   }
   else{                                                       //If state doesn't equal one of the declared values
     display.clearDisplay();
      display.setTextSize(1);
      display.setTextColor(WHITE);
      display.setCursor(0,0);      
      display.print("E: state= ");
      display.print(state);           
      display.display();
   }
}

void setAlarm(){  
  if(state==0){
    state=4;    
  }
  else if(state==4){
    if(alarmsetstate==0){
      alarmsetstate=1;           
    }
    else if(alarmsetstate==1){
      alarmsetstate=2;
    }
    else if(alarmsetstate==2){
      state=5;        
    }
  }
  else{
    display.clearDisplay();
      display.setTextSize(1);
      display.setTextColor(WHITE);
      display.setCursor(0,0);      
      display.print("E: interrupt ");                 
      display.display();
  }
}

void Nightlight(){
  
}

Your switch may be bouncing when pressed. Bounces will generate unwanted interrupts. Debounce with software or a 0.1uf cap across the switch will usually debounce the switch.

How is the switch wired? Do you have a pulldown resistor on the button input?

Honestly I don't know, because it's a grove button. This button can be directly connected to special conntection on the arduino which is an equivalant of D2/interrupt 0.

Is there a way to resolve these bounces?
And thanks for you quick response.

Read the link provided above

Thanks both of you.
It was indeed the bouncing and now that I know what it is I was able to resolve the issue quite easy with the code from (debouncing an interrupt trigger - Syntax & Programs - Arduino Forum) this post.

FYI The grove button has a pulldown resistor on module.
The meaning of pullup and pulldown for switches.