If an object with mass is moved up or down a distance Δh in a uniform gravitational field directed down, the change in gravitational potential energy is:
ΔUg = mg Δh
Here we're free to define the zero for potential energy at some convenient level.
Similarly, for an object with charge q moving a distance Δd parallel to the field, the change in electric potential energy is:
ΔUe = qE Δd
If a positive charge moves opposite to the field, the change in potential energy is positive. If it moves in the direction of the field ΔUe is negative. Just the opposite is true for a negative charge.
Once again we're free to define the zero for potential energy at some convenient level. What really matters is how the potential energy changes when the mass or charge moves.