The evolving far-IR galaxy luminosity function and dust-obscured star formation rate density out to z~5