A retired Salvation Army pastor has finished walking the length of New Zealand to raise money for foodbanks and help households struggling with the cost of living.

Gavin Baxter began Te Araroa Trail on New Year's Day at Bluff and finished at Cape Reinga three weeks ago.

He raised $30,000 for foodbanks to support households struggling with the cost of living, which is roughly $10 for every kilometre he tramped.

"There were times when I was thinking at least this kilometre we're raising another $10 towards foodbank work in New Zealand," Baxter said.

"I got to saying, well that kilometre was actually worth $50 and that one was worth $5 all of those sort of games you play to fill your mind with positive thoughts."

Half a million people in New Zealand are turning up at food charities needing help every month and the fundraising will go towards the Salvation Army's foodbanks.

"It's deeply satisfying in terms of knowing that that is a practical thing that money has been made available to purchase food and to help families," Baxter said.

"At the same time, you know that the target is only a drop in the ocean in terms of what is really needed."

During his almost seven months on the trail, blisters were a constant but Baxter's health took a turn in the South Island backcountry and he needed to be airlifted out.

He had kept walking through several days of abdominal pain and fatigue.

"Each day I was arriving later and later and just didn't have the energy that I was used to having and I knew that the next day was quite a significant climb out of the hut where I was," Baxter said.

"I thought, it's actually more sensible not to even try and take that on."

Concerned about his ability to safely continue through the Richmond Ranges and in a hut by himself, he activated his personal locator beacon and was airlifted to Nelson Hospital.

Baxter said he underwent medical assessment and was given antibiotics for an infection and advised to rest and recovery before continuing his journey.

"It was really just the sensible thing to do. I wasn't feeling great, I was in a remote area, and I didn't want to make a bad situation worse," he said.

"I was lucky enough to be in good hands. The Nelson Marlborough Rescue Helicopter crew and the staff at Nelson Hospital were excellent. They thoroughly checked everything over, looked after me well, and got me back on track."

The next stops he made off the trail were to visit foodbanks, including in Auckland, Whangarei and Kaitaia.

Baxter said it was inspiring meeting the people who work, many as volunteers, in these charities.

"The demand is there, but also these people are finding it just so satisfying to be able to help people and to meet some of those basic needs, like food and in some cases, clothing."

The challenge marked a fitting final chapter following Gavin's 31 years of service as a Salvation Army officer.

For now, he said more rest and recovery is in order but he would encourage others to walk Te Araroa Trail, even in sections.