"Change in internal energy is zero if temperature is constant because, internal energy is a function of temperature only." Well, this is what I read everytime I study thermodynamics. I came across a question where some heat (Q) was provided and due this heat supplied, a few moles of the gas dissociate. But, in this process, the temperature remains constant. If temperature is constant, change in internal energy should be zero. But, does this rule work even if some molecules dissociate? Will the internal energy change(although the temperature is constant) due to dissociation?
Change in internal energy is zero if temperature is constant because, internal energy is a function of temperature only
This true for an ideal gas, but not true for real gases where we get interactions between the gas particles. The obvious example of this is the Joule expansion. In this process no energy is added an now work is done so the internal energy remains constant. For an ideal gas the temperature does remain constant, but for real gases the temperature can increase or decrease depending on how the gas atoms/molecules interact with each other.
Your example of a dissociating molecule is basically an extension of this where the forces between the gas particles are strong enough to bind them into molecules.
In a Joule expansion some of the gas particles' kinetic energy is converted to potential energy or vice versa. The internal energy is the sum of the kinetic and potential energy while the temperature depends only on the kinetic energy. That's why when when the potential energy is significant the internal energy and the temperature are not simply proportional.
In the specific case of your dissociating molecule, we have to put work in to separate the parts of the molecule from the force binding them together, so the potential energy increases. The heat supplied to the system is going into the increase in the potential energy and leaving the kinetic energy unchanged. So the internal energy is increasing while the kinetic energy, and therefore the temperature, is not changed.