White wire connecting to the door switch has burned through and detached from the connector head. There are also burn marks on the dryer drum.
It looks as if the red connector in the first photo may not be the original, but a past DIY repair. I may be wrong, too.
Either way the wire should have a retaining clip close to the connection. The plastic grate in photo 1 most likely has a clip close to the terminal. If not zip tie the wires to a stable part of the dryer.
This most likely occurred due to vibration and the wire not being secured. If necessary solder the spade terminal to the wire for the most secure connection.