A memory worm was covered with a substance that could remove a short period of memory from any being who came in direct contact with it. The substance was also in the worm's fangs; if a worm bit an individual, the individual could lose decades worth of memories. (TV: The Snowmen)
Exactly how much memory was deleted appeared to vary; Strax appeared to lose only a few minutes, (TV: The Snowmen) whereas the Twelfth Doctor, Clara Oswald and Saibra appeared to have hours, if not days, worth of memories deleted. (TV: Time Heist)
A memory worm was in the possession of the Eleventh Doctor in 1892 London. He intended to use it to wipe Clara Oswin Oswald's memory of meeting him. However, his cohort Strax neglected to wear protective gauntlets while handling the worm, losing both his memory and the worm twice. Afterwards, Clara convinced the Doctor not to use the worm on her, as she needed to retain the memory of how to avoid conjuring the alien snowmen.
The memory worm was later recovered and used by the Doctor as part of a trap; the Doctor hid the worm inside a modern lunchbox, and gave it to Walter Simeon. The worm bit Simeon, causing him to lose the memories of his entire adult life, enough of a loss that it allowed the Great Intelligence to possess his body through the vacancy of his mind. (TV: The Snowmen)
The Twelfth Doctor, Clara Oswald and Saibra used memory worms to wipe their memories as part of a heist of the Bank of Karabraxos. The Doctor later had his memory restored by the Teller. (TV: Time Heist)