Beat 1/2 cup of softened unsalted butter and 3/4 cup of granulated sugar on medium-high speed for 2 to 3 minutes, until light and fluffy. Add 3 large eggs, one at a time, beating well after each one, then beat in 2 teaspoons of anise extract and 1 teaspoon of vanilla extract.
In a separate bowl, whisk together 2 1/2 cups of all-purpose flour, 2 teaspoons of baking powder, and 1/4 teaspoon of fine salt. Add the flour mixture to the butter mixture on the lowest speed and mix just until combined, 30 to 45 seconds. Stir in 2 tablespoons of whole milk only if the dough feels stiff. Do not overmix.
Cover the bowl and refrigerate the dough for 30 minutes. Meanwhile, heat the oven to 350°F and line two baking sheets with parchment paper. Scoop tablespoon portions of dough and roll each one into a smooth ball. Place the balls about 1 1/2 inches apart on the baking sheets.
Bake for 5 minutes, then rotate the baking sheets from top to bottom and front to back. Bake 5 minutes more, until the tops are cracked and the bottoms are light golden brown. Let the cookies cool on the sheets for 5 minutes, then move them to wire racks to cool completely.
While the cookies cool, whisk 1 1/2 cups of sifted powdered sugar, 2 tablespoons of whole milk, and 1/4 teaspoon of anise extract in a small bowl until smooth and free of lumps. Add the third tablespoon of milk only if the icing is too thick to dip.
Set a wire rack over a baking sheet. Dip the top of each cooled cookie into the icing, let the extra drip off, and set it back on the rack. Sprinkle with rainbow nonpareils right away, before the icing starts to firm up. Let the icing set for at least 1 hour before stacking or packing the cookies.