(N/A) Consider the electric field $\overrightarrow{E}$ due to a charge $Q$ placed at the origin.
We bring a test charge $q$ from a point $R$ to a point $P$ against the repulsive force exerted on it by the charge $Q$. (This occurs if $Q$ and $q$ are like charges).
Let us assume both $Q$ and $q$ are positive.
The test charge $q$ is sufficiently small so that it does not disturb the original charge configuration.
In bringing the charge $q$ from $R$ to $P$,we apply an external force $\overrightarrow{F}_{\text{ext}}$,while the repulsive electric force on charge $q$ is $\overrightarrow{F}_{E}$.
This implies there is no net force,i.e.,$\overrightarrow{F}_{\text{ext}} = -\overrightarrow{F}_{E}$. This means the charge is moved with a slow,constant speed,implying zero acceleration.
In this situation,the work done by the external force is the negative of the work done by the electric force and is fully stored as the potential energy of the charge $q$.
If the external force is removed upon reaching $P$,the electric force will push the charge away from $Q$. The stored energy at $P$ is converted into kinetic energy for the charge $q$ such that the sum of kinetic and potential energies remains conserved.
The work done by external forces in moving a charge $q$ from $R$ to $P$ is:
$W_{RP} = \int_{R}^{P} \overrightarrow{F}_{\text{ext}} \cdot d\overrightarrow{r}$
And the work done by the electric force is:
$W_{RP} = -\int_{R}^{P} \overrightarrow{F}_{E} \cdot d\overrightarrow{r}$
This work done is stored as the potential energy of charge $q$:
$\therefore U = \int_{R}^{P} \overrightarrow{F}_{\text{ext}} \cdot d\overrightarrow{r}$