What is this pipe coming out of the basement floor?
In a basement, galvanized pipe like that could have been a pipe feeding oil from an underground tank to an oil heater that has long ago been removed and replaced with something else. I had one like that and figured it out by looking at where an old chimney had been removed by looking at the sub-floor structures made to accommodate it. I didn't know exactly where the pipe lead until I accidentally found the tank one day in my front yard while digging holes to plant trees. That was an unpleasant surprise, cost me $10k to have the tank removed and the soil cleaned from leaks.

If it was natural gas, it would be black iron pipe, not galvanized. unscrew the cap and smell it, the smell of fuel oil never completely goes away. If water starts to leak out when you loosen it, tighten it up again right away!