Yes,
According to the first link below, the 521 is based on the 460 Block.
The 1994-2004 Mustang was called the SN-95.
The 460 engine swap for the SN-95 is fairly common, therefore the 521 swap will work.
The 2005+ models are called S197 mustangs.
460 swaps are less common since these cars are newer and have more powerful engines than the older models, but the swap is possible with these Mustangs too.
The 2nd link below shows information for big block engine swaps into SN95 Mustangs.