It's either the switch on the dash or the transfer case shift control module.The switch is fairly inexpensive and I would suggest you try it first.It will just pop out with a srewdriver.The module should be behind the passenger side kick panel and are known for being damaged due to water leaks from a winshield etc.Remove the module and carefully inspect for any corrosion on the pins or the terminals in the connectors.If corrosion is found both parts need replaced.