Hello and welcome to JustAnswer!
Is it the speed sensor on the rear differential that you're referring to? The transfer case module does look at this sensor to determine if a shift can be made or not. If the signal is missing then it won't shift, but at that time you also wouldn't have a speedometer.
Other possible causes for not shifting into four wheel drive would be the transfer case module itself, transfer case shift motor, the park/neutral switch, the transfer case switch itself, or wiring in between any of the components.
The first step in diagnosing the problem is to see what fault codes are stored in the transfer case module, if any. If no codes are stored to aid in diagnosis then data can be monitored while it's acting up to see why the module is either not seeing an input from the switch or inhibiting the shift.