Hydrogen from gas is not cost-effective (nor does it make any sense), but as more renewables are deployed, hydrogen production is an alternative to deploying energy storage to prevent wind and solar from being curtailed during periods of excess generation (eg. early afternoon for solar, middle of the night for wind), which would also make hydrogen much more cost-effective. This is already done in Germany.
I may have mentioned this before, but the big opportunity to me for hydrogen is in heating. There's also a push for electrification of HVAC and appliances that are often run on gas (stoves, ovens, etc.), such as some new construction residential developments in California which opted not to include any gas lines, but hydrogen can be mixed with natural gas and eventually gas utilities could theoretically just use hydrogen if it becomes cost-effective and/or legislation requires it. Australia and the UK are already testing this out.
Despite the on-going attempts by Tesla and a few other companies, I don't see electrification of long-distance freight as viable (but for school buses, city buses, mail trucks, maintenance vehicles, and the like, it should be over time.... I just saw today that there's even a company retrofitting small seaplanes to be electric-powered, and it's cost-effective), but whether hydrogen beats out compressed natural gas or not for long-distance transportation is up for debate.
That said, the energy density of batteries is continuing to improve, so there may be more uses for them than previously thought as that continues to improve.