The first law of thermodynamics states that $\Delta U=q+w$ where $ΔU$ is the increase in internal energy of the system, $q$ is the thermal energy supplied to the system and $w$ is the work done on the system.
I have a few questions regarding this law due to my elementary understanding of internal energy.
If an ideal gas is being compressed without supplying heat, $q=0$ and $w$ is positive. Now $ΔU$ must also be positive. This means that the microscopic kinetic energy of the particles $K_{E}$ is increased and hence temperature increases. But since the gas is being compressed i.e. the intermolecular distance is being decreased, does this play a role in decreasing $ΔU$?
If the gas above were being compressed at constant temperature then $q$ would have been negative so as to maintain a constant temperature. In this case does not the decreasing of intermolecular distances make $ΔU$ negative since $K_{E}$ remains constant this time?
Consider ice being melt into water at a constant temperature of 273K. Now the intermolecular distance of the molecules is being decreased here since water is denser than ice. So why isn't $ΔU$ negative here? How exactly do the microscopic potential energies of the water molecule come into play here?