Think about the work-kinetic energy theorem, which states that the net work done on an object is equal to its change in kinetic energy:
$$W_{net}=\Delta\mathrm{KE}.$$
You are right that when lifting an object of mass $m$ by a height $h,$ in a uniform gravitational field, the work you do is $W_{you}=mgh$ (assuming, as you said, that you're applying a force of $mg$), and for that same displacement, the work done by gravity is $W_{grav}=-mgh.$ The fact that these two cancel out ($W_{net}=W_{you}+W_{grav}=0$) means that the change in kinetic energy of the object after being lifted is $0$. So the work done by gravity went to sucking energy out of the object that you were adding, thereby converting it to gravitational potential energy. (If it did not get sucked out, then the object would gain kinetic energy--just imagine a case where you apply the same force to the object as you did when you lifted it, but this time there is no gravitational field. Then, since there will be a net force on the object in that case (or, net work will be done (by you)), the object's KE will increase.) Meanwhile, the change in gravitational potential energy of the object is $\Delta U = -W_{grav}$.
So, to summarize, you do positive work on the object by lifting it. Normally, that work would cause the KE of the object to increase. In this case, though, we have gravity doing negative work simultaneously, so the work you're doing is getting converted to potential energy by gravity. No net work is done, so the object has no KE after being lifted.
There's always confusion with this topic when it's not well explained. It's all inside "work-energy theorem", which says
$$\Delta E_k = W$$
But we'll make a distinction here: work done by conservative forces and work done by non conservative forces:
$$ \Delta E_k = W_C + W_{NC} $$
And now, we just call "minus potential energy" to the work done by conservative ones
$$W_{C}:= -\Delta E_p$$
We do this for convenience. We can do it, because a conservative force is such taht can be written as a substraction of a certain function $B$ like this:
$$W_C=B(\vec{x_f})-B(\vec{x_0}) $$
We just decide to define $E_p=-B$, so $W_{C}=-\Delta E_p$. We include that minus sign so that we can take it to the LHS:
$$ \Delta E_k = W_C + W_{NC} $$
$$ \Delta E_k = -\Delta E_p + W_{NC} $$
$$ \Delta E_k + \Delta E_p = W_{NC} $$
$$ \Delta E_m = W_{NC} $$
So the increment in mechanical energy is always equal to the work done by non-conservative forces. If there are no non-conservative forces, then $\Delta E_m=0$ and energy is conserved (that's why we call them like that.
(read it slowly and understand it well)
So, having this in mind, I think your confusion arises because of that famous "artificial" negative sign.
There are many formulas, and it's typicall to have a mess. It's all about surnames: $\Delta E_k = W_{Total}$, but $\Delta E_m=W_{NC}$. The subindices are the key.
The force of engines is non-conservative. Hence, their work contributes to total mechanical energy.
Gravity is conservative, so we can work with its potential energy.
If there is no increase of kinetic energy, that means
$0 + \Delta E_p = W_{NC}$
So engines are only increasing potential energy. But that means
$$-W_C = W_{NC}$$
Of course, if there's no gain in KE, no acceleration, there's equilibrium. The work of the engines is compensating the work of gravity.
- Negative work is always positive $\Delta E_p$, by definition.
- More altitude means more $E_p$, you are right. But here energy is not conserved (engines). Normally, increasing height would decrease $E_k$, but we're adding work so taht $E_k$ stays constant.
- $\Delta E_k=0$ implies $W_{Total}=0$. That means gravity is making negative work, and engines are doing positive work (equilibrium). The thing is that potential energy variation is minus gravity's work.
Best Answer
Part of the problem is to distinguish between the work done by a particular force and the net work done by all the forces. The second is to notice that the work done on an object depends on the process undergone. The third is to understand that the relationship between work and potential energy is that the work done by a conservative force is proportional to the change in the potential energy.
Let's walk through the scenario. A block of mass $m$ sits on the ground at position $y=0$. There are two forces acting: the gravitational force downward and then normal force upward. Newton's 2nd Law tells us that $$ m\vec{a}=\vec{F}_{\textrm{net on object}} = \vec{F}_{\textrm{G, on object by Earth}} +\vec{N}_{\textrm{on object by ground}}\,. $$ We'll abbreviate these as $\vec{F}_{\textrm{net}}$, $\vec{F}_{\textrm{G}}$, and $\vec{N}$.
In the case where the object is just sitting on the ground, the acceleration is clearly zero, and the normal and gravitational force cancel each other out. The block doesn't move, and so the net work done by either force must be zero: $$ W_{\textrm{by G}}=\int_i^f\vec{F}_{\textrm{G}}\cdot d\vec{r}=\vec{F}_{\textrm{G}}\cdot\Delta\vec{r} = 0\, $$ where the second equality holds beccause the gravitational force is constant near the surface of the Earth, and the third holds because the net displacement is zero.
Now, someone grabs the block, accelerates it upwards, and then starts lifting the block upwards at constant speed. Ignoring the acceleration part, as the block moves up at constant speed, the net force on it must be zero, and so the gravitational force and normal force acting must cancel, as they did above, although now $\vec{N} = \vec{N}_{\textrm{by person}}$, which we'll just call $\vec{N}$. The work done by gravity and the work done by the person lifting the block can be computed as follows: $$ W_{\textrm{by G}}=-mg(y_f-y_i)\,, $$ where $y_f$ and $y_i$ are the initial and final heights of the object, and $$ W_{\textrm{by N}}=N_{\textrm{by hand}}(y_f-y_i)\,. $$ Note that these two works are equal and opposite, and so the net work done is zero, as it must because the kinetic energy isn't changing! However, the works done by the individual forces are non-zero.
Looking at the $W_{\textrm{by G}}$, we can see that we can alternatively define it as $$ W_{\textrm{by G}} = -(U_f-U_i)\,, $$ where we define $U = mgy$ to be the potential energy when the object is at height $i$. Then, $U_f-U_i = mgy_f - mgy_i$ is just the change in potential energy as the object is lifted from height $y_i$ to height $y_f$. We could write this as $mgy_f - mgy_i = mgh$, where $h$ is the change in height, but this isn't a great way to do things, because $h$ could be negative (if the block moves downward), and it's easy to confuse a position with a change in position is if it's not notated correctly. I would write this as $mgy_f - mgy_i = mg\Delta y$.
To tie this in with the OP's specific questions, then, note that while the block is sitting on the ground, the potential energy is constant because its position doesn't change. The value of the potential energy itself is a meaningless quantity; it's only changes in potential energy that matter, via $W = -\Delta U$. We derive $U= mgy$ by considering the work done during a process in which the position of the object changes.
Last important note: the third bullet point requires a change in perspective, and without this change in perspective, things can go wrong (mixed up understandings and incorrect calculations). In our analysis above, we chose the system to be the ball, and we computed the change in kinetic energy of the ball by computing the works done by all forces acting on the ball. If these works cancel, then the net change in kinetic energy is zero.
If instead we move to a potential energy language, we have to reconsider what we call our system. Instead of thinking about the work done by the Earth via gravity on the ball, we consider a new system composed of both the Earth and the ball. In that case, we replace the work done by the Earth on the ball by the change in potential energy of the Earth-ball system, i.e., \begin{align} \Delta KE_{\textrm{ball}} &= W_{\textrm{N}}+W_{\textrm{G}} = \Delta KE_{\textrm{ball}} = W_{\textrm{N}}-\Delta PE_{\textrm{G}} \Longrightarrow \\ W_{\textrm{N}} &= \Delta KE_{\textrm{ball}} + \Delta PE_{\textrm{G}} \end{align} Since the kinetic energy of the Earth doesn't change, $$ \Delta KE_{\textrm{system}} = \Delta KE_{\textrm{ball}} + \Delta KE_{\textrm{Earth}} = \Delta KE_{\textrm{ball}}\,, $$ and so we can write $$ W_{\textrm{ext}} = \Delta KE_{\textrm{system}} + \Delta PE_{\textrm{system}}\,, $$ where $W_{\textrm{ext}}$ is the work done by objects outside the system on objects inside the system, or work done by external forces. In this case, that is the work done by the person in lifting the ball.