I'm trying to remember a cartoon I saw in the 1980s. It was probably an episode of an American television show.
The protagonists end up (somehow) in an underground realm where most of the residents (who might or might not have been human) had been enslaved by an evil, magic-wielding ruler. To free themselves and everyone else, the heroes decide to venture down a guarded tunnel to recover the artifact that can defeat the evil ruler. They take at least one local along with them.
They know before they set out that there are three dangers along the way. The first is a section of the cave where the passage becomes a mouth and tries to eat them. The second is a group of web-throwing spider people, and the third is a fire-breathing dragon. I don't remember how any of the three foes are defeated, but they all are, and the heroes recover a giant ring. Then they are teleported back to the main cavern, where they have to put the ring on the finger of a giant statue, before the villain (who had gone after the heroes to stop them) gets back. When the villain does return, the ring-wearing statue shoots some rays out of his eyes and kills the bad guy.