attachInterrupt and/or Serial.print (ESP32)

You can do so if you want. But debouncing a button by software is fairly easy and standard software programming. Think of a keypad or a button matrix with many buttons. Debouncing this by software is far more easy.