I then had a job in the UK where I paid tax, but have since received a tax refund for this.
This Canada Revenue Agency (CRA) page can help you determine if you are a resident for tax purposes: https://www.canada.ca/en/revenue-agency/services/tax/international-non-residents/information-been-moved/determining-your-residency-status.html