If they don’t have grit, you shouldn’t have given them earth worms. I made that mistake with my 4 week chicks, if you are going to feed them worms then they need grit and the worms need to be cut in small enough pieces to swallow. My chick had a small earthworm and swallowed it whole. For the next 15 minutes after eating it she just slept and kept shaking her head and gasping for breath. There was saliva leaking out of her mouth and she couldnt hold her head up. I really thought she was going to die but she recovered quickly.
Earthworms are difficult to digest for young chicks so I would stop giving them worms until they are old enough to break them into pieces by themselves and only if they have grit.
How old are they? How long has it been since they ate the worms?
I would look down their throats to see if the worm is lodged in their throat. If you can’t see a worm then the best thing to do is give them water and grit. The water will help the chicks swallow the worm if it’s stuck in their throats and the grit will help them digest it.
The chicks would take a day or to to start showing symptoms if they got gapeworms. So if they ate the worm a couple hours ago, it’s definitely not gapeworms.