For hard cheese, such as Cheddar, cut off at least 1-inch around and below the mold spot (keep the knife out of the mold itself). After trimming off the mold, the remaining cheese should be safe to eat.
For anyone’s interest, the rule of thumb is the colony on the surface is half the size of the depth that needs to be trimmed, so half an inch in diameter would be a one inch depth of removal
Moldy bread? Nah.
Moldy hard cheese? Just generously cut off the mold and it’s fine*
*I wouldn’t feed this to anyone else, but I’d eat it, and do all the time
EDIT: the USDA agrees that moldy hard cheese is safe to eat https://ask.usda.gov/s/article/If-food-has-mold-is-it-safe-to-eat
For anyone’s interest, the rule of thumb is the colony on the surface is half the size of the depth that needs to be trimmed, so half an inch in diameter would be a one inch depth of removal
Rule of thumb, don’t be a dumbass about it and you can do potentially dangerous stuff just fine
It isn’t potentially dangerous when properly trimmed though, that’s the point.