Had a 99 f150 that would do that. It was a loose ground on one of the transmission bolts. New battery and new starter later, just was a loose bolt. I’d make dang sure to check the grounds sure enough.