I find that I mostly use CMD Tab to switch between apps on my Mac and frequently use CMD Space to bring up Spotlight so I can launch apps.  Anyway these both suddenly stopped working.  I Googled this and the common advice is to go into the Activity monitor and do a forced close on the Dock.  This didn’t work for me.  I was just about to do a reboot when I noticed that I still had a VNC session running in the Dock.  As soon as I quit the VNC session CMD Tab started to work normally again.