The heat and work can not be defined at a particular state point. They are always defined as quantities in transit (boundary phenomenon). The amount of heat transfer or work transfer does depend on how the process happens. Heat and work are not intrinsic properties of the system.
Example 1: Suppose you want to go to the 10th floor of the building and you have two options for reaching there, either you take a lift or you take the stairs. The amount of work done by your body during this process is completely different in each case. If you take a lift your body needs to do a small amount of effort on the other hand if you take a staircase route, your body will do so much work that it will get exhausted by the time you reach the 10th floor.
Let's understand these concepts in a little more technical sense by using P-v and T-s diagrams.
Example 2: Suppose you have already decided on initial and final state points and you are trying to find out the best suitable path to reach the final state point from the initial state point.
There are multiple possibilities through which this can happen. I have shown 3 possible paths through which the system can change from initial state point 1 to final state point 2.
We know that the areas under the curve in P-v and T-s diagrams represent Work and Heat respectively. As you can see from the following figure, in each case the area under the curve is different, that is the work done is different. This can also be proved using equations by adding up the work done in each process of the path.
The heat transferred in each case is also different. Hence it is safe to say that heat and work are path functions and they depend on the path followed.Heat interaction in 3 different cases between 2 same state points
On the other hand, quantities like pressure, temperature, and volume are independent of the path. The pressure and volume values at state 2 are always exactly the same in all 3 cases above.