What to do about two logic gates connected to the same wire?
If those gates are both "totem-pole" outputs (where they actively drive the output high or low) then that configuration is undefined and "illegal".  For exactly the reason that you have discovered. The diagram you show is simply wrong and must be re-designed.

It is NEVER proper to connect the outputs from two active gates together.

There is a technique called "wired-or"  where the node is passively pulled high with a resistor, and EITHER of the gates can pull the node low. But that requires "open collector" outputs where they can only pull the output low.