Given the frequency of power outages caused by recent crises, including high-impact natural disasters, power and energy supply must be more resilient and cost effective. Owing to this necessity, this article presents a grid-connected multicarrier energy microgrid, which can provide continuous energy for both electrical and heating load demands at a low cost. The model employs a demand response (DR) scheme based on time of use and integrates with the proposed microgrid. Several energy sources - photovoltaics, batteries, a combined heat and power unit, and associated dispatch strategy - are optimized using the deterministic mixed-integer linear programming algorithm. The proposed model is tested in a hospital of California, USA. The results show the benefits of the DR program in terms of techno-economic output when compared to the system without its implementation. Several simulation results also demonstrate the model's effectiveness and resiliency in maintaining a continuous energy supply in the midst of power outages at various times of the year while lowering costs. Furthermore, a comparative study with the existing methods is performed, which shows the effectiveness of the proposed technique as well.