Backfiring

I started my car & it was backfiring & missing. I called my buddy who came over & started it & it ran fine. As we were looking under the hood, when the fan came on, the car started sputtering again. Sometimes when I start it, it backfires & sputters. I can shut it off & start it, and it runs good. Sometimes when going down the highway it’ll backfire. Again I can pull over, turn it off & turn it on and it runs fine. I’ve gotten advice on everything from timing belt, to plugs. It wasn’t the plugs. Could it be heat-related, or some kind of sensor? Or the timing belt? How would you approach this fix? I’d sure appreciate any help. Thank you.

It’s not a timing belt. That works, and then it doesn’t. It can’t go from not working to working by itself.
It sounds like some kind of electrical problem. Unfortunately, that doesn’t narrow it down much. I would start by a general electrical system check. Make sure that you have good DC voltage while the engine is running (13 to 14 volts) and that there is no detectable AC ripple.

Take it to a parts store and get the codes if there are any, and with this condition there should be. Is it backfiring out the exhaust or out the intake?

Exhaust