I dont think it's too distant to worry about. I am not convinced it will actually happen, but there is some cause for concern as many peeps WILL panic and that could affect vehicle values.
My thoughts are that this will be something like the pension age retirement age thing and keep getting put back as the time approaches. The science is not in place. The economics are not in place. The infrastructure is not in place.
There are zero realistic alternatives to petrol and diesel powered vehicles at the moment or even on the near horizon. They may as well state all cars must be hover cars by 2040 ..
An electric car with a range of 1 to 2 hundred miles only is no use to anyone unless they work on the doorstep. My daily commute is over 200 miles lol. I do that 5 times a week. If I work out our other office - its 400 miles turnaround.
I heard guff about installing charging points on every lamp post. Forgoing the vandalism and failure issues that would ensue, and how anyone might pay for all the electric used. I just looked up my road and in the few hundred yards I can see, there are exactly 7 lamp posts , two of those are right on a junction so must be disregarded. I count roughly 70 cars parked though. That is without walking and looking down drives... so 14 cars to a charging point then - that'll work (not)
Of course we could all run leads from our garages to the cars - I have 4 cars though, so which one gets charged overnight ? l have to leave one on the road cos my drive will only carry 3, so that means me and the other 64 cars on the roadside need to run electrical leads across the pavements.
I see no problems with that at all .....

And just to show how fecked up government policy is - it was only announced this week that the still unbuilt HS2 line will not be all electric as planned, swathes of it will still be diesel loco'd. IF that ever opens, it'd be around 2035+, so where the new trains gonna come from to run on it. Will they spend £millions on rolling stock that is outdated in well under a decade ?