UK inflation has risen to its highest level since March, driven by an increase in petrol prices last month, according to official figures.