I have read that this is just conservation of energy, but how is energy conserved even though a non conservative force ((P1-P2)V) is applied on the system?
Bernoulli equation is not a statement of conservation of energy, nor is it a result of just this statement. This is because energy of any liquid element we can apply this equation to does change, as a result of work of pressure forces from the side where the pressure is higher. The work of pressure needs to be taken into account.
Bernoulli equation is a useful equation that follows from the so-called work-energy theorem (not exactly energy conservation). The theorem says: work of external forces acting on a liquid element equals increase of kinetic energy of that element.
In the usual setup for Bernoulli equation, there are two forces that can do work on the element: gravity force, and pressure force. Together these change kinetic energy of the liquid.
Let the element have pressure $P_1$ upstream and $P_2$ downstream, and let $P_1 > P_2$ so the pressure forces upstream accelerate the liquid element by pushing on one its side of area $S$. Total work by those forces when the element moves along by one its length $\Delta L$ and by $\Delta h$ upwards is
$$
\text{work of gravity} + \text{work of pressure forces} = \text{increase in kinetic energy}
$$
$$
- \Delta mg\Delta h + P_1 S \Delta L - P_2 S \Delta L = \frac{1}{2}\Delta m\Delta (v^2)
$$
Dividing both sides by volume of the element $S\Delta L$, and introducing density $\rho = \Delta m/\Delta V$ we obtain
$$
-\rho g \Delta h + (P_1 - P_2)= \frac{1}{2}\rho \Delta(v^2)
$$
This still has the form "work equals increase in kinetic energy", but it is more customary to put everything on one side of the equation:
$$
\rho g \Delta h + (P_2 - P_1) + \frac{1}{2}\rho \Delta(v^2) = 0.
$$
Expression $P_2-P_1$ is increase in pressure $\Delta P$ (although in our case pressure decreases, so $\Delta P < 0$. We can write the result
$$
\rho g \Delta h + \Delta P + \frac{1}{2}\rho \Delta(v^2) = 0
$$
or
$$
\rho g h + P + \frac{1}{2}\rho v^2 = \text{const.}
$$
The first term is potential energy of unit volume in gravity field, the last term is kinetic energy of unit volume, and the middle term... is not energy at all. Pressure has no associated potential energy to it. The reason for this is the pressure term depends only on local pressure of the liquid, but the liquid is incompressible, which means the liquid does not have any additional energy due to being compressed. It takes zero energy to increase pressure in incompressible liquid. Thus the Bernoulli equation (the "const version") is not an energy conservation equation. It is a "work-energy theorem" equation, which is a bit obscured in the "const version" but completely obvious from the "Delta version". Pressure term is there because of work of external pressure forces. These forces do not have potential energy associated with them.