It is something to do with the shift interlock system. The main PCM for it is on the right side of the engine bay.
Check fuses for rear brake lights and bulbs to make sure they work as some systems actuallly include that as a safety fault.
I am attaching the instructions fo inspection and the wiring diagram for it. You may need a new componenent or there is a cable you can adjsut on the shifter.
The ignition Lock Solenoid Diagram is what you want to pay attention to first as you may need a new solenoid.