Getting infected with worms or other bacteria from eating sand is possible but it's also very rare and unlikely.
I used to eat sand as a kid and I've lived through it.
The main thing I would be worried about if a kid was eating sand was that they might accidentally get a rock in their mouth and then possibly choke on it.
So while you should really discourage kids from eating sand because they possibly could get worms or an infection especially if you don't know how clean the sand is from bacteria.
But I would not worry too much about it if my kids ate sand.
I had no health issues from eating sand as well as dirt and I'm still healthy and alive today.