Yes.
Worms belong to the group of animals called “insects”. They are not technically insects, but an insect is any small invertebrate with a three-part body consisting of head, thorax (midsection), and abdomen. Per Merriam-Webster’s Dictionary, the definition of an insect includes annelids such as earthworms and leeches. So yes worms are considered insects.