This paper presents a modification of a classical Godunov-type scheme for the numerical simulation of a two-phase flow in a pipe with a piecewise constant cross-sectional area. This type of flow can occur in wellbores during drilling for oil and gas as well as after well completion. Contrary to classical finite-volume schemes, the numerical scheme proposed in this paper captures the steady-state solution of the system without generating non-physical discontinuities in the numerical solution close to the locations of discontinuities in the cross-section. Moreover, the proposed scheme can be extended to problems with piecewise continuous cross-sectional area. This extension is achieved by discretization of the area along the spatial domain and converting the piecewise continuous area into a piecewise constant area. The proposed scheme reduces to the classical scheme when the cross-sectional area is constant along the spatial domain. For the purpose of computational efficiency, the modification to the classical scheme is only applied at the locations of area variation and the numerical solver reduces to the classical scheme where the cross-sectional area is constant. It is also shown that the proposed scheme can be effectively used to simulate two-phase flows arising from the perturbation of the steady-state solution. The effectiveness of the proposed scheme is shown through illustrative numerical simulations. Finally, it should be noted that the proposed scheme retains the same order of accuracy as the underlying classical scheme.