IC that allows two dc voltages to switch to one of them as output
A relay may be the simple answer to your need. You wire your output to the "common" terminal and then make it switch between 5V and 12V. Wire each DC input either to NC or NO taking into account which one will be used most of the time.

EDIT: if relays are not convenient for you, consider using analog switches like these from TI.