Demand response (DR) enhances building energy flexibility, but its application in hybrid heating systems with dynamic pricings remains underexplored. This study applied DR via heating setpoint adjustments based on dynamic electricity and district heating (DH) prices to a building heated by a hybrid ground source heat pump (GSHP) system coupled to a DH network. A cost-effective control was implemented to optimize the usage of GSHP and DH with power limitations. Additionally, four DR control algorithms, including two single-price algorithms based on electricity and DH prices and two dual-price algorithms using minimum heating price and price signal summation methods, were tested for space heating under different marginal values. The impact of DR on ventilation heating was also evaluated. The results showed that applying the proposed DR algorithms to space heating improved electricity and DH flexibilities without compromising indoor comfort. A higher marginal value reduced the energy flexibility but increased cost savings. The dual price DR control algorithm using the price signal summation method achieved the highest cost savings. When combined with a cost-effective control strategy and power limitations, it reduced annual energy costs by up to 10.8%. However, applying the same DR to both space and ventilation heating reduced cost savings and significantly increased discomfort time.