Inflation jumped to a three-year high in May as the Iran war continued to fuel higher energy prices.