The reference is clearly metaphorical. The fires of the battlefield did eventually go out. The fires of the Valley of Hinnom didn't literally burn continually, but there was always so much fuel being added that they were repeatedly rekindled, and so they metaphorically didn't go out, though literally they did.
People can't be eaten by undying worms and also burned. If you burn them the worms will die in the fire, and if you don't burn them the worms will eventually consume all of the flesh. The image is easily one of judgment, disgrace, and destruction. It is not so clearly about eternal torment, though it could be there. Oswald claims that the worship of the righteous is perpetual, so also must be the punishment of the rebellious. Glenn Peoples says the reference is to judgment for rebellion, not eternal suffering in hell.
John Walton writes,
"The focus here remains on the corporate level rather than on individual destinies. The ancient Israelites had no theology of hell as a place of judgment."