Although gas lighting disappeared earlier, gas for cooking (and refrigeration) in refreshment cars lasted until modern times, and presumably is what is still used on heritage lines with restaurant facilities. It's the only energy source they had if power was not coming down the train line from the locomotive, which I believe only came with the Mk 3. All the Mk 1 refreshment vehicles, which of course provided all the facilities in the Mk 2 era as well as these did not have any refreshment vehicles of their own, even the miniature buffets and the ones in dmus, had gas cooking, they had commercial Calor Gas propane cylinders in the underframe which were changed regularly; sometimes not regularly enough, "no gas" being one of the myriad excuses for lack of refreshment facilities.
The gas used changed over (1950s?) from the old coal gas previously used to the commercial cylinders.
The absence of power source and the poor features of the old coal gas system led the LNER in the 1930s to introduce "anthracite electric" kitchens, which essentially were coal-fired ranges (the junior chef had to double up as a fireman), with forced draught from electric fans to get adequate heat. Some early 1950s BR restaurant cars perpetuated this approach.
Here's a real sidebar, but my 1960 Hornby model railway catalogue had a "gas wagon", which was about 10 or so large gas cylinders (like huge beer barrels) mounted sideways on a wagon, with a substantial framing around them. One wonders what this was used to supply. The railway tended in the coal gas era to have centralised gas production facilities, but were such distribution vehicles still used by this time?
I do seem to recall that the last gas-lit service in London was mentioned by John Betjeman in one of his knowledgeable accounts as being the stock the LMS provided for the services from Broad Street to the LNER destinations like High Barnet or Potters Bar, up to 1939, with old North London Railway wooden-seated 4-wheeled coaches. An old agreement over the use of the terminus at Broad Street meant the North London, and then the LMS, had to provide the stock. I think the last gas-lit of all was again some wooden-seated stock used for coal miners' services in South Wales. Our colleague
@ChiefPlanner probably knows more than anyone else about this.