With common sense, we think work as applying muscle to do work. Well that's not always work in Physics. In Physics, it is the measure of how much force is applied to a body for a particular displacement of the body. It means it is the product of force applied on the body and its displacement due to that force.
If there is no displacement on a body you are doing work on, there is no work at all even if you are applying your muscle on it, for example carrying a box and staying still. Another example is you are applying force on a wall; you are applying force, so you may think you are doing work but the physical work is zero because there is no displacement.
We define work as the product of force on a body and its displacement. In Figure 1 a body undergoes a displacement of \( {\Delta \vec s} = {\vec s _f} - {\vec s _i}\) towards positive x-direction under the action of a constant force \({\vec F}\). But in Figure 2 the body undergoes a displacement of \(\Delta \vec s = \vec s_f - \vec s_i\) under the action of a constant force \(\vec F\) which makes an angle \(\beta\) with the displacement. The friction does not let you move the box initially, but once your force is greater than the friction, you can move the box and the box can have some displacement! If \(W\) is the work done, we have
\[W = {\vec F} \cdot {\Delta \vec s} \tag{1} \label{1}\]
Note that both \({\vec F}\) and \( {\Delta \vec s} \) are vectors but the work is a scalar quantity, so the work done is a dot (scalar) product of \({\vec F}\) and \( {\Delta \vec s} \). Therefore,
\[W = {F}\Delta s\cos \beta \label{2} \tag{2}\]
Note that friction always does a negative work as it always applies a force in opposite direction of displacement. The friction which does negative work is always kinetic friction. If you consider the friction between the surfaces of the box and the floor, the work done by the constant force \(\vec F\) is the maximum work done which is \(W_\text{max} = F\Delta s \cos \beta\).
The work done by the kinetic friction is \(W_k = f_k\Delta s \cos 180 = -f_k\Delta s\). Therefore, the total work done is \(W_\text{total} = F\Delta s \cos \beta - f_k\Delta s\) which is the same as the work done by the resultant or net force. The resultant force is the result of the sum of all forces on the body.
One interesting thing in Figure 2 is that the force \(\vec F\) has two components \(\vec F_x\) and \(\vec F_y\). The sum of the y-component \(\vec F_y\) and the normal force is balanced by the weight of the body and hence the normal force decreases. Therefore the kinetic friction decreases due to the y-component of the force \(\vec F\). In this case the work is done by the x-component \(\vec F_x\) only. Obviously the friction plays negative role here.
The SI unit of work is Newton-meter(\(\text{N}\cdot\text{m}\)) which is frequently used in Physics, so it has a separate name called Joule denoted by \(\text{J}\) which is \(1\text{J} = 1 \text{N}\cdot\text{m} = \text{kg} \cdot \text{m}^2/\text{s}^2\).
If the force is not always constant or the displacement is not always along a straight line, we find the small work through an infinitesimally small displacement (infinitesimally small distance has can be considered as displacement as it has a particular direction) in which the force can be considered as constant. Then we integrate to find the total work done along the whole path. If \(dW\) is the small work done by the force \(\vec F \) along an infinitesimal displacement \(ds\), then the total work done is,
\[W = \int {dW} = \int {Fds\cos \beta } \tag{3}\]
where \(\beta\) is the angle between the force and the displacement.
Work is something that is always associated with force and displacement and it represents a particular amount of energy. The term energy always comes from work in the physical world.
The result of work is stored as the energy which can do work again. So, something that can do work is called energy. Work or energy is always a scalar quantity because it does not have any direction associated with it, but we often use signed scalar to effectively determine the net work done.