I'll place it as the answer:
"Starchaser: The Legend of Orin" (1985)
Orin digs a tunnel to the surface of Trinia, where he is later captured by Man-Droids, a group of decaying half-organic, half-robotic beings who intend to tear him apart and use his body parts to replace their own.
Also, there is a city scene:
Dagg flies the Starchaser to a city called Toga-Togo on the planet Bordogon, where he abandons Orin and gives Silica to a slave auctioneer. Orin wanders through the city, trying to find a clue that will lead him to the location of the hilt's blade.