Sometimes, but usually not — and the important variable is when you use them.
The technical risk is real in specific cases. Cheat codes can trigger bugs and glitches, and the Grand Theft Auto games are the standard example: certain codes are known to break mission progression, corrupt saves, or leave the game in an unwinnable state. That is a genuine hazard rather than a scare story, and it is worth checking whether a code is flagged as save-damaging before you enter it.
For most games, though, a code does nothing worse than change the numbers. It does not harm the software, and it does not damage anything permanent.
The real cost is to your own experience, and it is entirely about timing. Using cheats on a first playthrough means skipping the challenge the game was built around — and challenge is where most of the satisfaction comes from. You finish faster and remember less. Come back on a second run, once you have already had the intended experience, and cheats become a toy rather than a shortcut: a way to break the game open, see the edges of the map, or just cause chaos.