https://mapumental.com/
It gives you time (not distance) between places, and it includes trains as well as buses. But perhaps you could use their API to tweak the results: https://github.com/mysociety/mapumental-scripts
Failing that, maybe try the NPTDR dataset: https://data.gov.uk/dataset/nptdr (again, times, not distances)