I have had to change my passport to travel, but the number on my passport for the flight back is different to the flight going out. Do I need to get it changed? How can I do this?
You need to provide your passport number at check in time. As flights can be booked almost a year ahead it's not uncommon to have your passport number (in my case, citizenship even, last year) change between booking and flight.
It depends how strict the countries involved are. Regardless, there are two options: You change it now or you change it later, up to check-in time.
It is common for stolen, lost or damaged passports to be replaced with one having a different number, so this is not something to really worry about it.
You can call the airline and have the change recorded in advance which will allow you to complete the online checkin process when your flight time comes. Otherwise, many (at least American ones) will fail to validate your passport info and you will be asked to do the check-in in person. Again, it is not a big issue, maybe needs a little more time than with online checking, depending on the airport/airline.