The paper considers the numerical modeling of the processes of homogeneous and heterogeneous condensation and evaporation in multiphase flows using the method of moments. Nonstationary processes of gas dynamics and phase transitions in the two-dimensional plane and axisymmetric regions are described by a general system of equations. The system of equations is expanded by adding two equations. One describes the evolution of the total mass fraction of the condensing substance; the other describes the evolution of the mass fraction of solid particles. An instant wetting model is used to model heterogeneous nucleation. The Gyarmathy model is used for the approximation of the average droplet growth rate. Heterogeneous condensation is modeled based on the distribution function of foreign impurities. An approach to calculating evaporation in the heterogeneous case is proposed. A comparison of the proposed models with a numerical experiment is given. Numerical simulation of homogeneous-heterogeneous condensation in a gas-dynamic ejector is carried out.