the last time when my circuit did something like that, my neutral was broken or shorted to ground.... either case those wires look nasty... I would just change it out.
how I did mine was... I used a contactless sitck and identify the circuit breaker, shut that off.. and shut off the whole panel, confirm no more live electrimacity . then used a extension cord and run it back to the panel and see which neutral , ground or line etc... with continuity... for shorts , grounded, etc. But I know the approximation where the wires go... a bit different from your problem.
For the really old basement wires that looked like yours, I just follow the line from one junction box to another and map it out.