MAX7219 Entering Test Mode and Displaying Random Characters
You have an EMI crosstalk problem from the abrupt break of motor inductance with current and made worse with any contact bounce on start or stop.
There are a few standard arc suppression methods.

Add clamping diode pair on each motor contact to prevent high voltage arc during open circuit.  Use 1N400x to each rail, so they are normally reverse biased. This prevents over/under voltage spikes V=LdI/dt where dt is almost instant.
Then use twisted pair power cable at right angles to the control cable to minimize crosstalk.
RC snubber to choose low Q filter 3A rated parts (optional)

Stopping the motor with BEMF with a short circuit across contacts will generate the locked rotor current of 2.5A until stopped and reversing the voltage will rise quickly to a 5A surge since the apparent motor voltage from BEMF will be double until steady state 400 mA if no load.
Normally this might done with a  (&gt;5x rated) 10A Nch H bridge with the top pair controlling direction and the bottom with PWM to create a boost voltage for top Vgs and also control current + acceleration with PWM rate.