I never particularly liked the textbook description of this topic.
The key concept is that there's a quantity called "energy" that we've decided is useful and can't be created or destroyed$^1$, it can just change "types". This is useful because if you choose a system you want to study carefully, you can learn a lot about its behavior from energetic considerations.
Broadly speaking, there are two types of forces, conservative and non-conservative forces. A conservative force is one for which a potential can be defined, and with that potential comes an associated potential energy. For instance, for gravity I can define a potential:
$V(\vec{r}) = -\frac{GM}{||\vec{r}||}$
And there's an associated potential energy:
$U(\vec{r}) = -\frac{GMm}{r} + U_0$
So gravity is a conservative force. The abstraction is that by lifting an object in the gravitational field, I do work and store energy in the field. The field can later release the energy, and no energy is "lost".
Friction is really complicated. It can be, and is, modelled simply, but the process at a microscopic level involves rapidly created and destroyed chemical and/or physical bonds and is not fully understood. When work is done involving friction, we decide not to describe this as energy being stored in some sort of "friction field" (we would need to define a friction potential, and there's no obvious way to do this). Instead, we describe the process by saying that the energy is dissipated by friction, lost as vibration or heat (note that these are both a type of kinetic energy - heat is just a description of the average motions of a collection of particles). The important difference as compared to a conservative force is that heat, for instance, cannot be released from a surface to make a block slide faster. The energy dissipated into heat is "lost" from the system of a block sliding on a rough surface.
With all that in mind, tackling energy conservation problems just takes a bit of practice. My advice would be to forget about the formulae a little bit. Instead, look at the system you're considering and try and account for all the relevant forms of energy, and all possible exchanges/transformations between types of energy. The big "trick" is to define the extent of your system carefully. Students I've taught seem eager to add a thermal energy term to their analysis of problems involving friction, but this is often not a useful exercise. If it's sufficient to know that some energy was dissipated away as heat, you can just include a term in the math that expresses that the system lost, for example, $\mu_kN\Delta x$ of energy.
If I had to break it down into steps, I'd say:
1) Pick the initial state of your system, tally up any potential and kinetic energy.
2) Pick the final state of your system, tally up any potential and kinetic energy.
3) Go through the processes that occur between the initial and final state. Do any of them dissipate energy from the system? Or inject energy?
4) Add everything up (being careful about the sign of each term). Any difference between the initial and final energy of the system should be accounted for by energy injected into or dissipated out of the system in between.
$^1$ At least in simple physics... you can formulate theories/models where energy is created/destroyed, but this is only done if there is some advantage to doing so.