I am trying to set my end GCODE to raise the Z axis 25mm above the top of the print.

Right now I am using G1 Z25 F5000 ; lift nozzle but if my print is higher than 25 the
head crashes into the print.

Will this fix that -

G91 ; set relative positioning
G1 Z25 F5000 ; lift nozzle