I would give both numbers. You use the COLA to say that the government thinks that people on Social Security deserve that much of raise. Compare the percentage increase of your raise to that. "Our 5% raise is better than the 0% raise that the government is giving to Social Security recipients."
You use the CPI to adjust last year's salary to compare with the current year's salary. The amount that this year's salary is larger than the inflation-adjusted version of last year's salary is your real raise. "Our real raise is 2% over inflation."
Real raise = ((Salary this year * CPI from last year / (Salary last year * CPI from this year)) - 1) * 100%
or
Real raise = 100% * Nominal raise * CPI from last year / (Salary last year * CPI from this year)
Note that CPI data is released monthly. Try to pick the same month in both years. Ideally you'd pick the month that the raise takes effect, but if the raise is recent that data might not be available.
Be careful about this. If your company skipped raises in previous years, then what really matters is the starting salary before skipping and the current salary. So a 5% raise this year might have to cover inflation in this year and some number of previous years.
It's also worth noting that for individuals, what matters is their actual expenses relative to their actual raise. If someone's rent is going up 10%, telling them that CPI is only 1% is not going to help.