2006 Rubicon bought yesterday, shifting problems

Father in law has had an old Arctic Cat and I finally convinced him he needed a Honda.

Found an 06 Rubicon, high miles, but runs good, plenty of power, tight front end, and was cheap.

Only issues seem to be occasionally the gear indicator on the meter will show —

It threw error code 5 last night when I went to back it off the trailer. I shut the key off, turned it back on, and it worked fine for the ride back to the shop.

Seems to intermittantly do this, especially if is ESP mode. If put in D1 or D2 it seems to do fine.

Looking at error code 5, looks like either the shift motor or the angle sensor could be the problem.

I plan to take off the front fender, clean all the connections, and grease them.

Given that the problem seems to be intermittant, more likely the shift motor or the angle sensor?

Open to any advice anyone can give. Haven’t ever really dug into a Rubicon before.