What you suggest will work just fine.
The airline only cares that you present them a passport that allows you to enter the country you are flying to. UK immigration wants to see a passport that allows you to work in the UK (if that's what you are going to do - if you were going as a tourist your Canadian passport would be fine). Coming back the airline wants to see a passport that allows entry to Canada, and Canadian immigration wants a passport that proves you can live there. Neither of the immigrations care what passport you showed to the airline.
You could also use your UK passport for everything on the outward journey and the Canadian one on the return, although that would involve providing two passport numbers to the airline, which would be unnecessarily complicated.