"Worms" in your apples are actually the larval form of the codling moth. Codling moth larvae can cause a great deal of damage to apples, pears, plums and walnuts by penetrating the fruit and boring into the core.
Trees should be monitored every week for signs of infestation. Infested fruit should be removed and discarded, to break the coddling moth life cycle. Sanitation is an important non-chemical step in controlling this pest. Make sure to pick up fallen fruit promptly, and pick apples with holes that are still on the tree. This will keep future populations down.
Pheromone traps can be hung in isolated trees. But if you have just one apple tree don't bother. You will just attract codling moths to your tree.
Fruit can be bagged for protection, but this is a very labor intensive method. Heavy infestations may require the use of pesticides on the moths, before fruit is affected. For more information, refer to the UC Pest Note on Codling Moths.