When a high energy particle, say a neutron, hits another particle, say another neutron – the neutron's mass does change. For example, if instead the first neutron moving at some high speed $v$ is captured and placed in a box, where it simply bounces off the walls without losing any energy in the collisions, and you then weigh the box on a very precise scale, the mass measured will be:
$$\text{Box max + neutron rest mass + extra mass}$$
The "extra mass" term is equal to $E_{kinetic}/c^2$, which will be equal to:
$$\left(\frac{1}{\sqrt{1-\frac{v^2}{c^2}}}-1\right) m_r
$$
where $m_r$ is the rest mass (invariant mass) of the neutron.
That is why in physics we distinguish "rest mass" from "mass" in general. Rest mass as it implies is the mass of the particle or object in a frame of reference where it is stationary. This is the "minimum mass" of the particle, and corresponds to the energy confined within it (quarks and gluons in the case of a neutron).
For speeds $v$ not too close to the speed of light $c$, the above expression can be simplified to:
$$\frac{E_{kinetic}}{c^2}= \left[\frac{1}{2}\frac{v^2}{c^2}+\frac{3}{8}\frac{v^4}{c^4}+...\text{(even smaller terms)}\right] m_r
$$
and if we keep only the first term, we get the familiar Newtonian expression:
$$E_{kinetic} = \frac{1}{2}v^2 m_r
$$
This illustrates that, in general, the mass of a particle is dependent on the speed $v$ of the particle, and is a measure of the total energy (internal + kinetic) of the particle.
With that being said, in modern physics the quantity $$M=\frac{E_{total}}{c^2}=\frac{E_{rest}}{c^2}+\frac{E_{kinetic}}{c^2}$$
known as "relativistic mass" is rarely used, if ever. Instead we speak of total energy content $E_{total}$ and do not name it "mass," reserving that word for the rest mass $m_r$. But nonetheless, the total energy $E_{total}$ does manifest as mass $M$ in scenarios such as the weight of the particle in a box.