Ok, so, I was wrong. That giant green thing threatening the Doctor is not a giant worm.
It’s a giant root. It helps to know the difference.
Yes, the Doctor is under attack from a giant root. It causes explosions when it hits stuff and everything. Sarah Jane is more fortunate as the thing that freaked her out is friendly. He’s another Exxilon, but his name is Bellal. He’s from a splinter group that wants to destroy the glowing city. See, the Exxilons used to be a space-faring race. Then they built an intelligent city that sort of…sucked up all their power. Also, it killed most of them. It sucks power from the ground with killer roots and from the sky with its beacon. And the Doctor wandered down the wrong tunnel.
Fortunately, two Daleks show up. Bellal, Sarah Jane, and another Exxilon manage to hide. The Daleks split up. One goes down the tunnel to the Doctor and does what Daleks do best. And by “best,” I mean “stupidly” by trying to shoot the root into submission. That never works. The root attacks the Dalek instead, killing the homicidal bugger. That means the Doctor can take his gun and backtrack to Sarah Jane’s position.
And when the other Dalek returns, Bellal can show the Doctor how to escape into the tunnels.
By the by, those roots attack the surface too. One clearly on strings pops out of a pool of water. It kills a native Exxilon and another trigger happy Dalek. Up there, Galloway is learning Daleks don’t share command very well as he and his people are split up against his better judgment.
So, what can the Doctor do? Well, like the Daleks, he figures the beacon’s destruction would allow the various ships to fly away. He and Bellal need to sneak into the city, and that means figuring out the city’s puzzles. The Doctor’s a genius. He can do that. Sarah Jane wants to go too, but the Doctor has a different task for her. She needs to warn the other humans to be ready for take-off the instant power comes back on. The Daleks aren’t going to let them take off easily.
Can the Doctor solve puzzles? Easily. He’s good at that. He even figures the ancient Exxilons taught the Incas how to build pyramids. Yeah, this was back when “ancient astronauts” was considered a valid theory by some. But there are two Daleks following, and the Doctor ends the episode by having Bellal stop in front of a weird floor pattern with the Daleks probably closing in behind them…