In a small saucepan, whisk together the sugar, cocoa powder, cornstarch, and salt. Pour in the milk while whisking. Place over medium heat and bring the mixture to a boil, whisking occasionally. Once the mixture starts to bubble around the edges, whisk constantly for 1 minute or until the pudding is thick enough to coat the back of a spoon. Remove from heat and whisk in the butter and vanilla.
Pour the mixture into a bowl, let cool for about 5 minutes then place a piece of plastic wrap directly on the surface of the pudding. Refrigerate for one hour.
Place the cookies in a food processor or blender and pulse until you have coarse crumbs.
Cover the bottom of 4 serving cups, mason jars, or glasses with cookie crumbs. Spoon ¼ cup of pudding on top. Add another layer of crumbs, then the rest of the pudding. Top with a final layer of crumbs and finally stick a few gummy worms into the crumbs.
Refrigerate uncovered for up to 48 hours or covered if you prefer the topping to be soft.