I'm assuming that this is the automatic gearbox so
I'd take a look at the colour of the transmission oil it should be a dark red colour if its black then its needs changing together with its oil filter. Also check its level with the gearbox warm and just after you've moved the selector through all the positions leaving it for a few seconds in each one and then back to park.
You can top up the box through the side fill plug if required and make sure you use the correct oil for your car as the fluids are not all the same. Some manufacturers recommended a change of the type of fluid - Speak to the local dealer and parts dept - they will advise you on the updated fluid to use..
If that’s all OK then check all the electrical connections of the gearbox, remove each connector in turn and spray with contact cleaner. Check that the wiring to the gearbox is in good condition with no chafing or frayed wire
If this is OK then check the selector lever linkage / cable under the car for any broken parts and or missing bolts as if this is coming adrift then it can rub on the car body or just bind up
Then - you should top up if low and re try it - or, if its level is ok - and condition is ok - then the next step is to drain it off - open it up and clean the filters inside -- refill and retry it..
Often - just doing the above cures many troubles with these - and you certainly can't condemn the unit without doing the above...