Bettas will actually train their owners into giving them their favourite food by ignoring the ones they don't want until you give them the ones they do want.
If he's eating the worms, great!
As far as pellets go, he needs to learn to eat them because they are balanced as far as nutrition goes. This is what I had to do with my worm-loving betta.
When Mako wouldn't eat pellets and kept spitting them out, I stopped giving him worms. I dropped one pellet in. He ignored it. I hovered my finger over it and he noticed it, but ignored it and continued to beg for food. I sat there for probably a good five minutes. Finally he came up and nibbled on it, but spit it out and let it sink to the ground. I immediately removed it and left him alone for a while. An hour or two later, I repeated the process until he finally started eating the pellets. Now I feed him an even amount of both.
You don't have to be that strict about it, I just was because, at the time, I had very little time to commit to my betta, so when I did have a day off, i corrected all of his behaviours right then and there so that I didn't have to deal with them over a busy week.
The important part is that, if your fish doesn't eat the pellet within three to five minutes, or lets it sink to the floor, REMOVE IT. This will teach them that the food will not be there for as long as they want it to be, and that there is a time limit on feeding. This rule should go for every feeding time until the fish gets it. If he doesn't eat the worms within three minutes, take the rest out, even if he begs for more. This not only saves your water from becoming foul, it teaches them about schedules and makes them realize that they cannot train you into giving them what they want all the time. This is only really necessary for new fish.
Also, it's recommended to feed your betta several small meals a day (And my small, I mean one pellet or two worms), skip a meal once in a while, and fast them for one day so their digestive system can properly break down their foods. Bettas in the wild go days without eating sometimes, as they are ambush predators.
However, it is only recommended. If you stay very consistent with one or two out of these three recommendations, you should be okay. Always use your judgement.