Peel, core, and slice the apples into ½-inch (1.25 cm) pieces, keeping them uniform so they cook evenly. Place them in a large bowl, drizzle with lemon juice, and toss to coat.
In a large saucepan or Dutch oven, whisk together the granulated sugar, brown sugar, cornstarch, cinnamon, nutmeg, allspice, and salt. Pour in the water and whisk until completely smooth.
Set the saucepan over medium-high heat and bring to a gentle boil, whisking almost constantly. Cook for about 2 minutes, until the sauce turns thick, clear, and glossy enough to coat the back of a spoon.
Add the lemon-coated apple slices and stir until every piece is coated. Return to a gentle boil, reduce the heat to medium-low, and simmer for 8 to 10 minutes, stirring often, until the apples are fork-tender but still hold their shape.
Remove the pan from the heat. Add the butter and vanilla extract, stirring gently until the butter melts and the filling looks glossy.
If baking a pie, let the filling cool to room temperature before adding it to a raw crust. For toppings, use it warm. The sauce thickens further as it cools.