We need more data. Is the 5 volts truly a digital one - that is, sourced by the output from a ic? Is the controlled voltage really digital in nature, as a digital count equivalent to 24 volts? Or do you need to step up a continuous analog voltage?
Also, does the control work as you have stated, so the 24 volts goes to zero as the control voltage goes to 5 volts? What kind of current does the load need?