The terahertz perfect absorber can be applied in the control, sensing and modulation of optical fields in micro- and nanostructures. However, they are only single function, complex device structure and low sensing sensitivity. Based on this, by introducing the bound state in the continuum (BIC) with infinite quality factor and field enhancement effect, and taking advantage of the phase transition characteristics of vanadium dioxide (VO 2 ), we designed a terahertz perfect absorber device which can actively switch between ultra-wideband and ultra-narrowband. The absorption mechanism is explained by multipole analysis theory, impedance matching theory and electromagnetic field distribution. The broadband absorption is mainly due to the electric dipole resonance on metallic VO 2 materials, and the absorption is more than 99% across 3.64-6.96 THz, and it has excellent characteristics such as robustness. Ultra-narrowband perfect absorption has a quality factor greater than 2200 due mainly to the implementation of symmetrically protected BIC with a sensing sensitivity of 2.575 THz per RIU. Therefore, this research could be widely used in the fields of integrated optical circuits, optoelectronic sensing and perceptual modulation of energy, as well as providing additional design ideas for the design of terahertz multifunctional devices.