But is there a role for CHP in an all-electric (or even more-electric) future?
Waste heats will be used. One that's already being used is heat from wastewater (converted using heat pumps to higher temperature). Also data center heat is increasingly being used to supply district heating networks with heat.
However, I suspect CHP usage amounts will reduce, being replaced by different kinds of waste heats. The main reason is that previously fuels were burned in baseload power plants that had combined cycle turbines and the waste heat was used to supply district heating networks. Those baseload power plants had capacity factors close to unity. They did somewhat follow the load on the electricity grid, but they were used more than standing still.
Baseload using burnable fuels can't compete in the modern environment. Wind and solar power will account for the vast majority of power production. The daily fluctuations in solar power and the varying electricity usage during day and night will be evened out by massive grid-connected batteries. Whatever hydropower we have will be used to follow the load in the electrical grid. Burning fuel simply can't compete with these better ways of producing and storing electricity.
However, the big question is, can we construct enough hydropower? Nearly all "free" hydropower where energy is supplied to us via rainfall is already being used. The only opportunities we have remaining are pumped storage hydro. Pumped storage hydro works best in mountainous regions, but not everyone lives close to mountains, so there's another option, construct hydrogen-burning power plants closer to electricity users, working at efficiency of 50% if producing only electricity. The rest 50% is waste heat, and it can be reused in CHP. The hydrogen would obviously be produced using electrolysis when renewable electricity is massively and cheaply available, and the waste heat from electrolysis would supply the district heating networks with heat when electricity is cheap.
So when electricity is cheap, electrolysis provides us the waste heat. When electricity is expensive, hydrogen CHP provides the waste heat. When electricity is mid-priced, neither can work, but fortunately large-scale heat storage is easy by storing heated water in massive caves.
So what determines the fate of CHP is whether we can have enough pumped storage hydropower to supply all areas with adjustable electricity production. If yes, then hydrogen CHP can't compete with its miserable efficiency and expensive fuel. If no, then hydrogen CHP will have to be used, but the amount of heat produced by CHP will decrease, since only 15% of our electricity would come from adjustable power plants, and out of that probably at least half will be hydropower, so at most 7.5% would be the share of CHP.
So CHP might have a future, but used only intermittently, with the rest of heat being reuse of other waste heats (electrolysis, wastewater, data centers) and heat storage. And even that's a "might" and not "will", since it is indeed possible that pumped storage hydro can solve all our electricity storage needs, in which case hydrogen would be still produced (for steelmaking and fertilizers and other chemical industries), but never converted back to electricity in CHP plants.
In any case, the only fuel CHP plants will use in the future would be hydrogen, simply because it's the most reasonable fuel that doesn't produce any carbon dioxide. Mobile installations (ships, airplanes etc) might see a benefit from ammonia as hydrogen carrier, but fixed installations would use compressed hydrogen stored underground and delivered in a pressurized gas network.