Worms are not kosher. If you find a worm in the apple you wish to eat, do not eat it. Besides for being unappetizing, the worm is not kosher for consumption.

On the subject of worms, note that (some) worms have a very prominent place in Judaism. The sages tell us of a special worm called the shamir, which was able to cut through stone. King Solomon used this worm to cut the stones of the Holy Temple in Jerusalem, which were not to be cut with iron axes or other tools of metal.