An optical structure containing the ferrite defects and Fabry-Pérot cavity with a narrowband absorption feature and a sensing performance is proposed and modeled in theoretical scope. These two features appear alternately on adjacent frequency ranges with modulation of the coherent perfect absorption by altering the phase difference between the two coherent incident lights. For the absorption band, the relative bandwidth reaches 9.7%. Benefiting from the modulation of the magnetic field applied in the ferrite layers, the quality value of the absorption peak is 494.85, which indicates the potential for use as a sensor. There are highly linear relationships between the refractive index values of dielectric layers and the spike absorption frequencies. The accurate analysis of the RI from 2.7 to 3.4 can be realized. The sensitivity and the average detection limit are 1.287 THz R−1IU−1 and 7.46 × 10−4 RIU. The figure of merit is up to 83.03 RIU−1. Similarly, the structure is also competent to detect RI of another kind of dielectric layer from 2.2 to 2.85. The corresponding parameters are 1.241 THz RIU−1, 7.12 × 10−4 RIU, and 77.53 RIU−1, respectively. Meanwhile, the effects of the incident angle and machining inaccuracies are also discussed.