What is the best way to freeze apples? I am planning on cooking with them when they defrost.
Depending on what you're going to cook, there are a few ways you can freeze them.
For most uses, I find the simplest method is just to peel, core, and slice them. First, you want to keep the slices from browning using one of the following methods:
Personally, I prefer the lemon juice method, it's proven to be quite effective for me and I always have lemons in hand in the house.
Freeze apple slices on a single layer on a cookie sheet (in the bottom of the freezer) then transfer to a Ziploc bag when solid. The sheet method allows them to freeze as fast as possible in the typical home freezer, and prevents them from sticking together so you can portion them as you need them. If you're going to be storing for a long time, wrap them in plastic wrap and then foil before putting in the bag.
Some people just wash and freeze them whole, though I prefer do to the prep before freezing so I can just pull them out of the freezer and use them. They will freeze well whole, however I find that the ruptured cell walls cause them to be harder to peel/core after defrosting using this method.
If you're going to make a pie, you can also freeze them with sugars and spices etc (prepared just as you would make a pie filling) in a pie pan. You can then take them out of the freezer like that, drop the prepared, shaped mixture right into a pie crust, and bake your pie with a slight increase in baking time.
As far as how long they'll last, they'll be safe indefinitely, but will lose flavor after a few months, I wouldn't recommend going past 6. Stilltasty says 2-4 but I've pushed it further than that and there wasn't a ton of flavor loss. Might depend on variety of apple as well.
The suggestions on this page are in line with my personal experience (and expand upon them!)
Cooked apples freeze with no special consideration; so you are almost certainly better off cooking them first then freezing.