How to make Arduino runs continuous routines even inside a "switch case loop".

Separate the "getting the thing to do" (entering the key code) from the "doing the thing".
A simple state machine (good search term there) will help.

Get rid of "delay()"s.

Make your functions non-void, so they actually do return something.