Is it safe? Yes, as each cable has the proper insulation for the voltage it carries. The question is; Do the power cables inject noise into your Ethernet cable? If it is a shielded CAT-6 it should be fine. While 50/60 HZ power is ignored by the high frequency Ethernet runs at, it can pick up HF noise injected into the power lines, including your 24 volt power feed.
So the issue is do you have to use noise filters on your AC and DC power feeds to keep from inducing noise into your Ethernet feed? If you're powering motors, contactors, solenoids and other inductive devices they can and will induce noise-burst into local signal cables. Most data downloads are checked for errors and corrected, but streaming video screams in at full speed with no error checking.
So without noise filters on your AC and DC power feeds you should be able to download data and code with no problems, but streaming video could be full of glitches and pixelation if your power feeds are noisy.
For this reason Ethernet is normally run at least a yard/meter from power feeds.