Possible bad or loose connection on the cabin air temperature sensor or it's dirty, which is most of the time the case, look on the trim panel just below the ignition switch you will see a group of small holes, the sensor is mounted on the back of the trim panel behind the holes, sometimes the holes get clogged with dust or the sensor itself is covered with dust, either will cause false temperature detection by the sensor, if you find that it's dirty use compressed air or a soft brush to get rid of the dust.
If that's not the issue then you could have a bad blend door solenoid, it's unusual for it to go bad where it only work at either hot and or cold but not in between, usually it would be stuck at one or the other setting/temperature