Sometimes, especially in the case of older games, some video games have hidden cheat codes that could be entered to get all kinds of effects (such as getting infinite lives, all items, etc.) These are usually deliberately programmed into the games as some kind of easter eggs.
In speedrunning, both unassisted and tool-assisted, using cheat codes are usually banned, even if the cheat code is fully supported by the game itself, and can be entered fully from within the game using normal controls.
However, in general, if somebody discovers a glitch, an unintended bug in the game that can be exploited, that achieves something similar as the cheat code, or perhaps even the exact same thing, it's allowed.
More particularly, some game could have a cheat code that allows you to jump to any level in the game, such as the final level. Using such a cheat code is usually banned. However, if somebody discovers a glitch in the game that can be used to jump to the final level of the game, it usually will be allowed (at least in an "any%" category).
But when you think about it, the question arises: Why?
Why is one allowed and the other not? What's the difference? Both methods achieve the same effect, so why allow one but not the other? Or why not ban both? What is the reasoning behind this?
If the rationale is "the cheat code makes the game too trivial; there is no challenge", it's not a very good explanation because using the glitch would probably still be allowed even if triggering it was very easy, and anybody could do it as easily as entering the cheat code, without requiring any particular skill or practice. So the cheat code making the game trivial cannot be a good explanation of why.
What else is there?
No matter how much I think about it, completely honestly and without prejudice, I can't come up with a rational reason for the difference. It seems to be a matter of principle, held without any actual good reason that would explain it logically and rationally. No matter what explanation one could think of why using the cheat code shouldn't be allowed, the exact same explanation could be used to argue why the glitch shouldn't be allowed either. Essentially, it's just "because reasons". Period.
In fact in one online conversation some years ago about tool-assisted speedruns I raised this question, and even went so far as to ask that if the glitch actually jumps to the exact same program routine that the cheat code jumps to, the answer was still that yes, the glitch would be allowed but the cheat code wouldn't. Even though both methods would be doing exactly the same thing, the only difference would be how the routine would be triggered. Nobody in that thread could give a rational reason for this. It was just a matter of principle, and nothing else. Glitches allowed, cheat codes programmed into the game not allowed, no matter if both do the exact same thing. Why? Because. No reason, really. Not any rational reason at least. It simply has been decided, and it apparently requires no reason.
And, for some reason, everybody seems to just accept this, without requiring a reason. (It appears to me that many peopled don't even want to think about a good reason. Very often when this topic comes up, people will say things like "you just have to accept it, people aren't going to do as you want", as if it were some kind of matter of religious belief or something. Conversations can become really strange, and oddly heated and confrontational. I can't even begin to comprehend why.)
In my personal opinion both methods should be disallowed. Especially if the glitch is doing the same thing as the cheat code, the glitch should be banned precisely for the same reasons as using the cheat code is. Any rationale you can give to ban the cheat code can be applied to using the glitch. It would only make sense to ban the glitch, if the cheat code is banned.