For a variable force $F(x)$, if the displacement $\Delta x$ is small, the work done $\Delta W$ can be approximated as:
The NCERT text states: 'If the displacement $\Delta x$ is small, we can take the force $F(x)$ as approximately constant and the work done is then $\Delta W = F(x) \Delta x$.'