Worm
A worm is a tiny creature whose root is in holiness, as it is said, "the worm of Yaakov."
The Worm of Holiness
The holy Zohar states:
"And Israel have no strength or power to defeat them except with their mouth, like this worm that has no strength or power except in its mouth, and with its mouth it breaks everything; and for this reason Israel are called a worm. Furthermore, 'Fear not, worm of Yaakov': just as with the worm, there is no creature in the world like this silkworm, from which come forth all the precious garments, the robes of kings; afterwards it sows seeds and dies, and afterwards, from that seed which remained of it, it is restored as before, and behold, it endures. So too, Israel are like this worm, for even though they die, they will return and endure in the world as before." (Zohar I, 178a)
Translation: Israel have no power to defeat their enemies except with their mouth, like this worm whose power is only in its mouth, and with its mouth it breaks everything; therefore Israel are called a worm. "Fear not, worm of Yaakov": just as the silkworm, from which come forth all the garments of kings, afterwards sows its seed and dies, and from its seed its offspring are born as before, so too Israel, although they die, return and endure as at the beginning, at the Resurrection of the Dead.
Separating the Good from the Bad
In the writings of the Arizal it is explained that the word "olas" (עולת) in "olas tamid" in the passage of the Tamid offering alludes to the worm (תולעת) of holiness, which nullifies the worm on the side of the sitra achra that rots the G-dly light, in the sense of sleepiness, laziness and sadness. The worm of holiness is a holy vitality that comes as a result of holy humility, as in the saying of the holy Baal Shem Tov that a person should consider himself equal to a worm, for just as the worm does the will of its Maker, so he does the will of his Maker, and he is no more important than a worm.

This separation of the worm of holiness from within impurity was carried out in the Chamber of Wood in the Beis Hamikdash, which was located in the northeastern side of the Women's Courtyard. There they would prepare the wood for the perpetual fire that burned constantly on the Copper Altar, and there they would also inspect the wood so that it would contain no worms, since it is forbidden to offer a worm - which is an impure thing - upon the altar. This work was done by Kohanim with blemishes, who are disqualified from the services of the Beis Hamikdash.
The Shamir Worm
The shamir worm was a worm used to cut the stones that were used for the Beis Hamikdash, which indicates the subjugation of the kelipos and their incorporation into holiness.
The meaning of the name shamir is a strong worm that can split even the hardest stone. (The Rebbe expressed himself this way in encouraging Yitzchak Shamir, and said that he knows how to stand firm on the interests of the State of Israel and to resist the pressures being exerted on him to hand over territories that are under the sovereignty of the State of Israel.)