Controlled growth of heterostructured nanowires and mechanisms of their formation have been actively studied during the last decades due to perspectives of their implementation. Here, we report on the self-catalyzed growth of axially heterostructured GaPN/GaP nanowires on Si(111) by plasma-assisted molecular beam epitaxy. Nanowire composition and structural properties were examined by means of Raman microspectroscopy and transmission electron microscopy. To study the optical properties of the synthesized nanoheterostructures, the nanowire array was embedded into the silicone rubber membrane and further released from the growth substrate. The reported approach allows us to study the nanowire optical properties avoiding the response from the parasitically grown island layer. Photoluminescence and Raman studies reveal different nitrogen content in nanowires and parasitic island layer. The effect is discussed in terms of the difference in vapor solid and vapor liquid solid growth mechanisms. Photoluminescence studies at low temperature (5K) demonstrate the transition to the quasi-direct gap in the nanowires typical for diluted nitrides with low N-content. The bright room temperature photoluminescent response demonstrates the potential application of nanowire/polymer matrix in flexible optoelectronic devices.