How to change temperature every 25 layers (or 5 mm) in Ultimaker Cura or G-code?
Every time you see a Z movement that matches the layer height (eg. 0.20&nbsp;mm) you can assume that is the end/start of one "layer".
It should have a line like:

;Layer count: 17
;LAYER:0.  ; mine has this as the first layer
M107
G0 F2400 X67.175 Y61.730 Z0.250. ;  moves to Z0.250 mm for the first layer, with layer thickness 0.25 mm


Then later:

;LAYER:1
M106 S255
G0 F2400 X78.078 Y69.627 Z0.550 ; 2nd layer.


So search for "Z" or "Layer" and once you've seen 25 of these "small" movements (comparing to previous Z movement?), insert your line of code at the end of the layer commands.  Don't confuse it with large Z-movements, that may correspond to move up/retract filaments.
Depending on your goals for the print, maybe you also want to insert a wait time - say a minute or two for the new temp to stabilize?  Here is the line for that:

G4 P200  ;  Sit still doing nothing for 200 milliseconds.