Internal energy depends only on the actual state of a system and not on how that state is attained.
A state function describes the equilibrium state of a system. For example, internal energy, enthalpy, and entropy are state quantities because they describe quantitatively an equilibrium state of a thermodynamic system, irrespective of how the system arrived in that state.