I think it's not a good idea. There are a couple of issues, one is that you want to keep them in your intestines, rather than giving them an incentive to move out. So give them something to keep them there, like some form of glucose. Second, is that if you do get a big worm kill, you want to get the mass of dead worms out of your intestines as quickly as you can, it is a better idea to eat a lot of roughage so that your bowels keep moving and you do not get a blockage consisting of a bunch of dead worms. If you have either a tape worm or round worm infection, they can be surprisingly large critters, and they are pretty toxic.
It's up to you, let me know how it goes, I'm interested in your results if you do try a fast.