AIUI, economists measure inflation by comparing prices of a "basket of goods" – the contents of which change over time, specifically to reflect changes in consumer habits, technological progress, and other non-monetary factors. If we can trust or agree that the basket is updated frequently enough with sufficient accuracy at a broad scope, then inflation should indeed be comparable over decades.
Here's how the UK defines its basket of goods, and the rules for changing it: https://www.ons.gov.uk/economy/inflationandpriceindices/arti...