Gear shift won't move all time sometimes no problem. on 1997 Chevrolet 1500 Pickup

I can put it in gear no problem, then I can park it start truck back & it won't move I can keep messing with it & brake pedal then it we will move fine can do it over over works great then turn it off try again may or may not work??

poss pwr issue to shift lock solenoid.start by cking brake light switch