This could be the camshaft sensor, the engine computer, or something else. If it is the computer, newer ones (probably starting in 1996?) you can kind of fix solder joints on and it might fix it, older ones have the main board covered in potting compound and really can't be worked on. Either way you can try to outright replace it. But it might be easier to check the camshaft sensor first. I'm not an expert I will admit, and my Jeep still seems to have issues after replacing both, but these are solutions that have worked for other people.
Probably a cracked solder joint on one of the pins going to the connector. This happens all the time with the VICs in these. If you're good with a soldering iron you could try reflowing the solder joints, but be aware there is a slight rubbery coating over them that needs to be scraped off, otherwise they don't tend to solder well.