If you need to use an isolated DC/DC converter, and you will also need an isolator for signals to/from the 24v and 5v system.
If you don't need isolation, then you can still use an isolated DC/DC converter if it's all you have available. Just link the ground of the 5v and 24v system. Just make sure that signals from the 24v electronics are limited to 5v if passed to the 5v system. If passing signals from the 5v system to 24v system, you may need a way of boosting the signal from 5v to 24v.
The reason you might want isolation is if transient spikes created by relays are interfering with the 5v system. However, it shouldn't be necessary; Spikes from relays can be suppressed using a diode across the relay like so:
simulate this circuit – Schematic created using CircuitLab
Does that answer your question? If not, perhaps you can give more information, such as what your 24v system does, what components it has, etc, and what information/signals flow from/to
the 24v and 5v systems? Also, are there any interfaces to other systems? (e.g. do the relays control mains equipment, and are there any other connections between the 24v/5v system and other systems? Perhaps you can supply a complete circuit diagram of your entire proposed system, with examples of what the system is going to be automating?