I can't speak for UK but in Canada the tax obligation is based on the time of residency and non-residency.
In a calendar year (Jan - Dec) if I was working part way in Canada, I would have to pay tax on the income to UP TO the day you hop on the plane. The non-residency form filled specifiies the date you will depart Canada (hence non-residency status in Canada). Any income earned AFTER the departure will have to be shown on the NZ IRD tax return. However, earned income in Canada requires a tax return to Canada regardless if non-resident or resident. The 1st obligation for that income would be to Canada but still has to be shown on the NZ IRD form.
There is no double taxing as each form has a section for "foreign tax credit"
Again, i can't speak for UK tax laws.
BQ