You can use a circuit like this to get close to what you want to achieve.
Found on: https://forum.arduino.cc/t/switch-microcontroller-on-and-off-with-a-button-and-mofset/1047044
It is a latching circuit with the special property that you can use the same button to power up the Arduino and later when the Arduino is running, test the button in code.
It works like this. If the Arduino is powered off, pressing the button powers up the Arduino. Your program will immediately (or after a specific chosen interval) switch on D6. This sustains the latch.
Now in your code, you can detect the button press and do what you like with it. Maybe power the device off by setting D6 to LOW if the button has been pressed for X ms.
If you want the device simply to enter sleep mode on a button press, then you can do that also. However, it gets a bit more complicated because the button then has to be used to wake the device. That means setting a pin change interrupt on pin A0 and then testing A0 on wake up to determine the length of the button press. If it is too short, then you can force the Arduino to resume sleep.
3 seconds press (on) - Short press during operation (sleep mode) - Long press during operation (3 sec.) shutdown
... please add that to the question ... it does not belong in a comment