It is known that luminescent optical sensors are perspective for detection towards nitroaromatic compounds that are a basis of a many kind of explosives. Operation of these sensors is based on quenching luminescence, which is caused by photo-induced electron transfer from a luminophore (donor) to a nitroaromatic molecule (acceptor). The conjugated polymers, small molecule dyes and metal-organic frameworks are used as a sensitive luminophores currently. One of the methods to improve these sensors is embedding the luminophore into porous matrix with properties of photonic crystal, which may be a porous silicon (pSi) Bragg mirror or a microcavity (MC). The PPV derivatives polymers are usually used as the sensitive luminophores for embedding into pSi matrix. However, there is a task to find an optimal set of luminophores to develop a highly sensitive and selective sensor. In this work we investigate embedding of 5- triphenylamino-4-(triphenylaminothiophen-2-yl)-pyrimidine (HEM-461) into pSi MC and examine the sensitivity of obtained structures. The pSi MC were fabricated using a standard electrochemical etching process. The eigenmode of the pSi MC had a width of 4-6 nm. The samples were oxidized to stabilize the surface chemical properties and to prevent quenching of luminescence of the embedded luminophores after fabrication. The embedding of the dye into the pSi MC was performed at excess pressure. Well known conjugated polymer MDMO-PPV was used as a reference. In this work, we compared the photophysical properties of MDMO-PPV and HEM-461 in solution and into pSi MC. The luminescence parameters and resistance to heat have been studied. Comparative studies of sensitivity of MDMO-PPV and HEM-461 to trinitrotoluene in liquid and gaseous phases have been carried out. It was concluded that pSi MC with embedded HEM-461 is a promising structure for developing sensors of nitroaromatic compounds.