Line an 8x8 inch baking pan with parchment paper, leaving an overhang on the sides.
In a medium saucepan, combine sugar, butter, and evaporated milk. Cook over medium heat, stirring constantly, until the butter is melted and the sugar is dissolved.
Bring the mixture to a boil and cook, stirring constantly, for 5 minutes. Do not stir after it starts boiling.
Remove from heat. Stir in vanilla extract, chopped pistachios, and almond extract (if using).
Pour the mixture into the prepared baking pan and spread evenly.
Let the fudge cool completely at room temperature for about 2-3 hours, or until firm.
Once firm, lift the fudge out of the pan using the parchment paper overhang. Cut into squares.
Notes
Store the fudge in an airtight container at room temperature for up to a week.