If a mass is moved up or down a distance Dh in a uniform gravitational field directed down, the change in gravitational potential energy is:
DUg = mg Dh
Here we're free to define the zero for potential energy at some convenient level.
Similarly, for a charge q moving a distance Dd parallel to the field, the change in electric potential energy is:
DUe = qE Dd
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 DUe 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.