Two HC-05 modules won't stay paired

If you get 0 from mySerial.available(), then no characters have been received.

If you have not attempted to transmit any characters, then mySerial.avalailableForWrite() should return the buffer size. With that 5 ms delay, you should never need to use mySerial.availableForWrite().

Baud rates of 38400 and higher tend to be unreliable with SoftwareSerial.