That's what happens when you use a 3-prong cord on a dryer or range!
3-prong cords are bad. This is why.
The 3-prong plug is a throwback to the days when nothing was grounded. The dryer uses 240V for most things, and also uses 120V for the timer mechanism, motor or display, which is why it needs neutral.
When the NFPA started requiring grounds, the appliance industry pushed back. They were afraid they would lose appliance sales into millions of homes that only have 3-wire (NEMA 10) receptacles, because homeowners would not want to retrofit. So they haggled with the NFPA to allow them to use neutral as ground, which would be bootlegging anywhere else. Their logic was the plug is rarely disturbed and unlikely to fail.
Clearly that is not the case.
There's some sort of problem with the neutral wire somewhere, and it's not returning properly and is flowing current from a hot to a 120V device to neutral/ground to chassis to you to the washer. The problem is probably in a wire termination. You could fix it, but then you'd just be betting your life on the neutral wire again. That's not exaggeration, this problem kills.
I recommend you retrofit a ground wire, and convert the receptacle to 4-wire, grounded NEMA 14. The dryer is new enough that it's designed to be wired for either a 3-wire or 4-wire connection. If you do the latter, it will be properly grounded and unable to shock you. Just get a NEMA 14 cord and rejumper the dryer per its instructions.