How do I avoid a race condition in SR latch?
Attaching LEDs like that to a little CD4001 is drawing too much current from the output when powered from only 6V. You are pulling ~8mA and the device is only rated for closer to ~2mA.

What will happen with that type of SR latch is the high output will be pulled down to close to the threshold level of the other gate and it will switch and settle to whatever side is less strained, or it might oscillate.

You should reduce the load, or change the way the LEDs are driven. One possibility is to use the other two NORS in that package as a buffer.







simulate this circuit &ndash; Schematic created using CircuitLab

But you will still be straining the outputs.

Also make sure you have decoupling capacitors on that chip.