Heat and work are path dependent functions. Give some examples I dont understand how can the amount of work done be different when the inital and final states are the same if it has followed a different path . in the same way heat also baffles me because heat is a form of energy still is not a state function whereas other forms of energy are 
 A: Suppose you have an ideal gas, which satisfies $PV= NKT$. Also, according to the first law of thermodynamics, work done by external forces will be $dW=-P dV$. This means that if the gas expands, the "external forces" do negative work, that means they are actually gaining energy. Now, imagine we do this cycle:

A) At constant preassure $P_A$, rise the volume from $V_D$ to $V_B$. This will give $W_{A}=-P_A (V_B-V_D)$.
B) At constant volume $V_B$, lower the preassure from $P_A$ to $P_C$. This will not do work because $dW=-P dV$ so if we don't have volume variation we don't get work.
C) Now, at constant preassure $P_C$, lower back volume from $V_B$ to $V_D$ to get to the point where we started. This will do $W_{C}=-P_C(V_D-V_B)$
D) Rise preassure from $P_C$ to $P_A$ at constant volume $V_D$. Again, this will not do work.
Now, the work done in $A$ would be the opposite of the work done in $C$ but, because the volume variation was done at different preassures, $W_{A}$ is higher than $W_{C}$.
This example shows that, although we made a cycle and came back to a point with the same preasure and volume (and thus same temperature) the work done in the cycle wasn't zero. This is, as you said, because Work is not a state function.
Work and Heat are not state functions in a way that makes energy a state function. They compensate their bad behaviour. 
There's an easy example to see this. Suppose you want to heat water from temperatures $T_1$ to $T_2$. If you do it adiabatically doing mechanic work then $\Delta U = \Delta W$ so work will be a state function as $U$. If you do it by heating the water without doing mechanical work then $\Delta U = \Delta Q$ so now heat will be a state function as $U$. But if you do it in a weird way combining heating and doing mechanical work, the work done and the heat transfered in the process would differ from those in the previous examples. However, energy $U$ must be still a state function, so $dW$ and $dQ$ must compensate somehow to give the first law of thermodynamics:
$dU = dQ + dW$
