Worms are generally considered to be a subset of viruses, but with key differences.
A worm is a computer program that replicates, but does not write its code to other files:
instead, it installs itself on a victim’s computer and then looks for a way to spread to other computers.
From a victim’s perspective, there are observable differences.
In the case of a virus, the longer it goes undetected, the more infected files there will be on the computer.
In the case of a worm, by contrast, there will be just a single instance of the worm’s code.