In your second example no work is done by you or the wall on the block because there is no displacement of the block. That is not to say you didn't expend any energy pushing on the wall. But the work you did is internal physiological work, and not physics work. Richard Feynman explained it this way in his physics lectures:
The fact that we have to generate effort to hold up a weight is simply due to to the design of striated muscle. What happens is when a nerve impulse reaches a muscle fiber, the fiber gives a little twitch and then relaxes, so that when we hold something up , enormous volleys of nerve impulses are coming in to the muscle, large numbers of twitches are maintaining the weight, while other fibers relax. When we hold a heavy weight we get tired, begin to shake, ...because the muscle is tired and not reacting fast enough.
That said, work can be positive or negative. Work is positive if the direction fo the force is the same as the direction of the displacement of the object. Positive work transfers energy to the object. In your first example you did positive work of 50 Joules on the block.
Negative work occurs if the direction of the force is opposite to the displacement of the object. Negative work takes energy away from the object. If in your first example you pushed the block on a floor with friction, the floor does negative friction work equal to the kinetic friction force times 10 meters. Friction work takes the energy from the motion of the block and dissipates it as heat.
If the block started at rest and ended at rest at 10 meters the negative friction work equals your positive work for a net work of zero. Per the work-energy theorem the net work done on an object equals its change in kinetic energy.
Hope this helps.