Sounds like the gear position switch isn't reading quite right, or the electronic automatic transmission ECU is throwing a fit.
If it's intermittent it's probably cabling and / or sensor related.
This comms was upgraded in the 99 MY, when they introduced a controller area network digital comms structure.
The gearbox ECU is hidding under the left hand seat (at least for UK models), and requires removing the plastic trim to get to. Depending on your mechanical / electrical inclinations I'd start checking the connections there, as well as at the control box on the gearbox itself (you'll need to get the vehicle raised up on high to get at them).
HTH
---
Staffan Tj.
'96 RR 4.6HSE NAS
115K
Rioja Red / Walnut