Line an 8x8-inch baking dish with aluminum foil and lightly grease both the base and sides. Set the prepared pan aside.
Equally distribute the sweetened condensed milk between two small or medium saucepans, ensuring each pan receives just over half a cup.
Place the dark chocolate chips into one pan and the white chocolate chips into the second.
Warm both pans over medium heat, stirring continuously until the chocolate is fully melted and smooth.
Remove the pan containing the dark chocolate mixture from the heat, blend in the vanilla extract, and promptly pour the mixture into the prepared pan, smoothing it into an even layer.
Take the white chocolate mixture off the heat, stir in the peppermint extract if desired, and mix in ¼ cup (approximately 50 g) of the crushed candy canes. Immediately spread this over the set chocolate base layer.
Top with the remaining crushed peppermint pieces, ensuring even distribution.
Let the fudge firm up completely before slicing—this will take about 4 to 6 hours at ambient temperature or approximately 1 to 2 hours if placed in the refrigerator.