Why heat of reaction under neither constant pressure or constant volume is considered (in my textbook, or probably somewhere else)?

So my textbook gives me this random equation: $\Delta U = q + w$. Then consider two conditions, under constant pressure and under constant volume. Because $w = -P\Delta V$, constant volume will make $\Delta U = q$. And constant pressure equation is basically the same.

But why is isn't heat under neither condition considered? Because it is of significance?

The constant pressure and constant volume scenarios are presented when you first study thermodynamics because they present an easy way to simplify the calculation of energy changes ($\Delta U,\ \Delta H,$ etc.) based on the change of one easy to measure phenomenon.

Internal Energy $U$

So, the change in internal energy must equal the sum of the work done $w$ and the heat transferred $q$. This is not random, it is a consequence of the Law of Conservation of Energy. If the internal energy of a system has changed then energy must be exchanged with the surroundings. There are only a few ways this can happen (heat, work, electromagnetic radiation, ...), and heat and work are the most important for most thermodynamic scenarios.

Thus, $\Delta U = q + w$. We need to be able to relate $q$ and $w$ to things we can measure. We calculate $q$ based on the temperature change of the system $\Delta T$ and the heat capacity of the system $c$. Thus, $q=c\Delta T$. Work is defined (in one way) as the change in volume of the system times the pressure. The negative sign is present to make sure that an expanding system is doing work on the surroundings (and thus losing energy): $w=-P\Delta V$.

Now we have $\Delta U = c\Delta T -P\Delta V$

Constant Volume

If volume is constant $\Delta V = 0$, which means that $w=0$, regardless of pressure. Thus, $\Delta U = q = c\Delta T$.

Constant Pressure

This one is trickier, but we can do it for a gaseous system.

We do not need to measure volume, since $PV=nRT$, but it is easier to measure volume than $n$, which may also be changing. If $n$ is constant, then, the equation for change in internal energy becomes:

$$\Delta U = c\Delta T - nR\Delta T$$

If $n$ is not constant, then we need to measure that change in volume and temperature.

If the process is in another state, like in solution, $\Delta V$ might be very challenging to measure. Let's hope we can measure $\Delta n$.

Enthalpy $H$

Because of the challenge of measuring volume changes in solution, we invented a new thermodynamic potential $H = U + PV$. Total differentiation and whatnot gives us: $$\Delta H = \Delta U +P\Delta V + V\Delta P = c\Delta T - p\Delta V + P\Delta V + V\Delta P$$ $$\Delta H = c\Delta T + V\Delta P$$

Thus, at constant pressure, $\Delta H = q = c\Delta T$, which is easy to measure. Enthalpy is similarly challenging at constant volume as internal energy is at constant pressure.

Constant pressure and volume.

Under these conditions, $\Delta U = \Delta H = q = c\Delta T$.

Pressure and volume are not constant

Okay, so if $w=-P\Delta V$, how do we calculate work? If pressure is changing, which value of $P$ do we use? It turns out we use all of them and we need some calculus to do it. This case is often left out because many introductory textbooks consider the likelihood that many students beginning their study of chemistry may not have taken calculus.

Here we go. We need to replace the total change in $V$ with the infinitessimal change in $V$ at each moment $\Delta V \rightarrow dV$. $\Delta V$ is the sum of all of the infitinessimal $dV$ values. Now, we can multiply each $dV$ with the pressure at that moment and add them up to get work (which involves integration):

$$w = \sum_{j=1}^n P_j dV_j=\int_{V_i}^{V_f}PdV$$

However, we cannot leave well enough alone, because $P$ is changing, so we need to substitute for $P=\frac{nRT}{V}$.

$$w=\int_{V_i}^{V_f} \dfrac{nRT}{V}dV=nRT\dfrac{\ln V_f}{\ln V_i}$$

Now the above maths only work if temperature is constant. What if it's not?