If it worked properly a short while ago then either the diverter valve is jammed or failed, the DHW demand switch is jammed on, a sensor has failed or rarely the PCB has failed.
You may need to call a gas engineer unless you have the skills to try to repair it yourself.
Tony