Might not be anime (or just Japanese animation, I don't know the difference).
I don't remember much from this movie other than a brief glimpse of an aerial view of the caterpillars moving like a herd. And the hero (or heroine) who sacrifices him/herself by jumping, or throwing herself/himself in the way of gun/laser fire. There were quick-cut shots of the laser/bullets hitting the character. Then (I believe) the caterpillars somehow heals the hero/heroine.