Cursor changes position in input line after I highlight some text to overwrite it
The most likely culprit once you rule out Bluetooth mouse / trackpad and any wrist or liquid input is hardware. 

If you can reproduce this on a clean os install onto an external drive (to avoid wiping your normal drive and files and apps) it could be:


failing battery pressing underneath the trackpad
failing or damaged capacitive sensing grid 
failing chip that processes the capacitive touch sensor


It's unlikely to be software, but I'd still download and install a clean and updated os to be sure unless you have close and easy access to hardware service.