Cheese can sit out safely for up to 2 hours.
After 2 hours the cheese can grow bacteria and can become unsafe to eat.
If not eating or using the cheese within 2 hours it should be kept refrigerated.
Hard cheese such as block cheese can be lef out longer and can sometimes be okay overnight left out depending on the temperature.
I have personally left hard cheese out overnight and it's been fine but if it were hotter inside the room then the hard cheese could spoil faster.
There's also the risk of having maggots get into the hard cheese if left out longer than a few hours.
I always try to remember to put any leftover cheese or dairy products in the fridge if not consuming or using within a few hours.
Sometimes I forget but not all that often.
If I left soft cheese out longer than a few hours then I throw it out even if it may be good.
It's not worth the risk of getting sick or possibly dying.