To find all positive integers whose squares end in three 4’s :

Last line says : Consequently if N = 500k \pm 38, then {(N)}^2 ends in three 4s (Why)?

Can someone just explain to me this solution? I have no clue on how the HCF system works and how he got to that conclusion.

Thanks