A 5" piece of my tailpipe is only 2" away from my fuel tank.
Never blown up yet
Though the rest of the tail pipe is 5 "away from tank.
I'm no expert, but 3" clearance would be fine by me.
Ignition of the petrol will require a flame and only the vapours will ignite, not the fluid. My guess is that it should be OK as long as the fuel tank is not plastic.