Think of it like this. When you have an object of mass $m$ which is held a height $h$ above some reference point, you think of it as having potential energy (considering only gravitational interactions) $U= m g h$, and gravity will exert an amount of work $W_g = m g h$ on the object. When you drop the object, it shall fall towards the ground, towards “equilibrium”, so to speak. You do not speak of the amount of “work” that the mass has when at its original height, nor of the amount of “work” lost, but of its energy (relative to a reference point) at any given state, $U$. Moreover, we say that this potential energy is a state function because it depends only on the initial and final heights of the mass in question.
In the same way, one does not concern his or her self with the amount of “heat” that an object has, since it is merely a term used to denote the amount of transferred energy between systems as they move in and out of equilibria. We speak of thermal energy, internal energy, free energies and such that are state functions of the system - in exactly the same way that the gravitational potential energy $U$ was in the mechanical analogue to this thermodynamical case. In the same way, we say that the thermal energy of the system is a state function insofar that it generally depends (more or less) on the initial and final temperatures and thermodynamic quantities of the mass in question.
Edit: I’ve reread your question and I want to make another point to clear things up. Yes, indeed, different paths can result in different amounts of heat transfer - the first law of thermodynamics states:
$\delta E = Q + W$,
wherein $Q$ is the amount of heat flow into the system, $W$ is the work done onto the system, and $\delta E$ is the total state internal energy change of the system. One can see that one can input say, 100 J of heat and do no work on a system to result in a net change $\delta E$ of 100 J, and in the same way, one can divide that $100 J$ amongst $W$ and $Q$ to get the same effect.
The intuition is as follows. Imagine you have a jar of gas. You can increase the temperature (and so impart a positive $\delta E$) by adding $100 J$ of heat, or you may compress it by doing $100 J$ of work to gain the same effect. I hope that clears things up!