When try and copy and past in any app it does not work. It only works in spotlight.

I also noticed in safari I sometimes can not do a space when typing, i have to go to spotlight, hit spacebar in there and then do it in safari and it would work

The only way to make the copy and paste function work is by restarting my mac. it only happends sometimes, this is like the second time in about 2 weeks

Does anyone know why this is happening and how to fix it?