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?
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.