Gas and crude oil won't last forever but it's good enough to get us going while we still aren't capable of harnessing renewable energy very efficiently.
Once we have developed better technology, gas and crude oil will have lower economic value. Until then we will still use it.
I'm sure that the future of energy is nuclear power plant but solar energy can also be a good alternative. We're literally just waiting for solar panel that can generate more efficiently right now.
Gas and oil won't last forever, but OPEC countries still have vast amounts of oil reserves. The number seems to be increasing by the day. That's odd, because I remember when experts once said that the supply of oil on the planet was scarce. Guess they were wrong. If there's plenty of oil left, the industry won't be going anywhere. That means gas-powered cars, generators, etc. will continue to be relevant. More carbon pollution for the planet.
Nuclear and solar energy holds promise, but the infrastructure is not there yet for mass adoption worldwide. Countries need to invest heavily in these technologies if they want oil to become history. The government would be responsible to force such a transition (like Biden's EV mandate in the US). Some countries have big economic interests in oil (like Venezuela, the UAE, and Russia), so it would not be easy to fully transition into clean energy. We'll see what happens in the long run.