It first depends on either the condition being Acute or Chronic.

When your back or neck pain is acute and there is soft tissue swelling, ice or cold helps to lower the swelling. That’s usually the case for most musculoskeletal and orthopedic injuries including knee, ankle, neck, back or shoulders. Ice or cold is also helpful after spine surgery to help lower the swelling in the postoperative period.  However, prolonged use of ice or cold should be avoided as it can affect tissue healing especially in compromised patients with risk of non-healing such as in immunocompromised, diabetics or smokers.

In injuries that are older than 6 weeks and are chronic, there is minimal soft tissue swelling.  Inflammation and swelling are in the deep structures such as the neural tissues, discs and facets.   Heat generally increases the blood flow carrying the reparative cells to the site of the inflammation.  This is especially true when taking medications like steroids or other anti-inflammatories. Increased blood flow will increase the delivery of the medication to the site of inflammation.  You can also try cold to alleviate your pain symptoms but keep in mind that although it will lessen the pain, it may decrease the blood flow and worsen the muscle spasms once the effect of the cold wears off.  Therefore, if you decide to use cold, use it judiciously and avoid prolonged application.   Alternating between the two modalities is also an option for some patients

When home remedies like cold and heat therapy don’t help with your neck or back pain, try to contact a spine surgeon for an evaluation. Your spine surgeon can provide you with recommendations on non-surgical treatment options based on your diagnosis.