Most of the caps you are thinking of are for vacuum lines. They will not stand up to fuel. Ask me how I know. I did exactly what you are talking about 3 or 4 years ago. It worked for a few years. Then, one time we came home from an RV trip, and when I opened the garage door, the smell of raw gas hit me in the face. I am shocked that a spark from the garage door did not start a fire. The plug had deteriorated, and it had been dripping (I assume) for days. I rolled it out of the garage and temporarily stopped the leak with another vacuum plug. Of course the gas tank was full, so I drove it around (no real chore) and then used a short piece of fuel line with a plug and two hose clamps to fix it. I plan to get a new sending unit and replace it this winter after welding that hole closed.
Only if the rubber is rated for gas
Trust me, it will. See above. I'm lucky I didn't burn my house down.