High-resolution neutron powder diffraction is used to investigate the phase separation and microscopic nature of the magnetoresistance in complex half-doped manganites. Investigations are performed by the example of Sm0.32Pr0.18Sr0.5MnO3 exhibiting the colossal magnetoresistance effect. The structural transition from a high-temperature orthorhombic Pbnm phase to a mixed phase containing two (orthorhombic Pbnm and monoclinic P21/m) phases is revealed. A gradual decrease in the amount of the orthorhombic phase and, consequently, an increase in the amount of the monoclinic phase are observed with decreasing temperature. Redistribution of the two phases ceases below T ≈ 100 K. Low-temperature analysis of the magnetic contribution to the experimental neutron-diffraction patterns indicates that the magnetic ground state of the compound under study is phase-separated and corresponds to a mixed state involving three magnetic phases formed at different temperatures: a ferromagnetic phase, A- type antiferromagnetic, and CE- type charge ordered antiferromagnetic phases with charge-orbital ordering. Ferromagnetic ordering arises near room temperature in the orthorhombic Pbnm phase and manifests itself only until helium temperatures. The A- and CE-types antiferromagnetic states (T N ≈ 170 and 120 K, respectively) appear in the monoclinic crystallographic phase.