A very general discussion-Not specific to a system:
The internal energy, $U$, of a system is a function of state, which means that its value only depends on the thermodynamic variables ($P, V, T)$ for example, at a given state (this means for a given set of values of these variables).
Let us make this more concrete: Imagine the system is in a thermodynamic state where the thermodynamic variables have the values ($P_i, V_i, T_i$) ($i$ stands for initial). At these values of the thermodynamic variables the internal energy has a value:
Internal energy at the initial state $i$: $U(P_i,T_i,V_i)$.
You can think of a gas at pressure, volume and temperature condition ($P_i, V_i, T_i$). Now imagine you change the thermodynamic variables to these ones ($P_f, V_f, T_f$) ($f$ stands for final). The internal energy now has a new value
Internal energy at the initial state $f$: $U(P_f,T_f,V_f)$.
In this process you have changed the internal energy of the system by an amount:
Change in U: $\Delta U= U(P_f,T_f,V_f)- U(P_i,T_i,V_i)$
I hope it is clear to observe that the system could have followed an infinitely large set of $(P,V,T)$-points, along an infinitely large number of different paths in order to go from state $i$ to state $f$. However, these are not, in any way, influencing by how much $U$ will change, you can take which ever path you please to go from state $i$ to state $f$. So the system has no memory of the intermediate states.
In mathematical terminology, this means that the differential change, $dU$, is a perfect differential and this is stated by the simple mathematical expression
It is very similar to the gravitational potential of the Earth, for example, which tells us that the amount of energy we need to spend to lift an object by 3m, does not depend whether we bring it straight vertically up or we follow some other path.