Magnetic flux structure on the surface of EuFe$_2$(As$rm_{1-x}$P$rm_x$)$_2$ single crystals with nearly optimal phosphorus doping levels $x=0.20$, and $x=0.21$ is studied by low-temperature magnetic force microscopy and decoration with ferromagnetic nanoparticles. The studies are performed in a broad temperature range. It is shown that the single crystal with $x=0.21$ in the temperature range between the critical temperatures $T_{rm SC}=22$ K and $T_{rm C}=17.7$ K of the superconducting and ferromagnetic phase transitions, respectively, has the vortex structure of a frozen magnetic flux, typical for type-II superconductors. The magnetic domain structure is observed in the superconducting state below $T_{rm C}$. The nature of this structure is discussed.