If and while loop at the same time

Hallo, im new to Arduino and testing stuff out.
But i'v been kinda stuck on something that looks simple.

I want to be able to spam a button and make it count up.
While the counter counts down ever second.

But it seems like it will complete the while and the if cant happen at the same time.
I tried it with a for loop and a while in a while, but i cant seem to make it work.

int buttonPin = 2;
int buttonState = 0;
int i = 5;


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
 pinMode(buttonPin, INPUT);
 pinMode(4,HIGH);
 

}

void loop() {
  buttonState = digitalRead(buttonPin);
  
  if (buttonState != 0){
    delay(10);
    i++;
    Serial.print("number");
    Serial.println(i); 
    delay(1000);
    
      while (i != 0){
      delay(500);
      digitalWrite(4, HIGH);
      delay(500);
      digitalWrite(4, LOW);
      Serial.println(i);
      i--;

      
      }
}}

I am not clear what you want to do but those delay()s will be a problem as the Arduino will do nothing whilst they occur. You need to consider using millis() for timing so that you can implement non blocking timing. See Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

You have:

  pinMode(4, HIGH);

but you probably mean:

  pinMode(4, OUTPUT);

It is not clear how you want this to work. Do you want a button press to increment the counter but have it automatically decrement every second? When do you want to flash the LEDs during this process?