How can I replace a SN74LS04?
Generally, without having looked at any of these chips in particular, yes:

What you need here is the same functionality – if it's from the same logic family (LS), then it will react to compatible voltage levels.

You'll need to make sure these are actually the same functionalities – e.g. some things have push-pull outputs, other open drain, some things have tristate logic, others not...

Timing would not necessarily be the same – but considering this is breadboard, it's very unlikely that timing restrictions arise from the logic gates; the thing will be limited by the wiring parasitic effects.