Cold = vasoconstriction (limiting blood flow) and hot = vasodilation (opening blood flow). Cold is *believed* generally better for you within a short time (minutes) after an intense workout. Some people take this to the extreme and do ice water baths after they work out. This has a few known benefits such as reduction of swelling (inflammation) and numbing of pain receptors. As far as I am aware, a big point of contestation and change of understanding is what causes delayed onset muscle soreness (especially with the understanding of lactate). It's known that exercise stresses muscle and connective tissue which causes microtears and inflammation. Cold can help with reducing that inflammation reducing the pain, toxins, and stress on the surrounding tissue. But, blood flow is needed later to remove waste and toxins, promote healing, and regrowth into stronger tissue. Heat can help promote blood flow through vasodilation.
You need to be careful of a few things concerning usage of cold and heat. Cold makes tissue stiff and reduces swelling, both good (lubricating) and bad (inflammatory). It's very easy to injure tissue once it is cold so movement needs to be very careful and limited. Heat can cause inflammation, so painful swelling and arthritic cases may want to avoid heat application.
If you are going to apply cold, I think the general best practice is to do so within minutes after your workout and cooldown. Several hours later, heat is generally applied. I usually do cold showers but nothing too extreme. Heat later that evening and next day. (added) I also go through a physical rehab series which uses steam heat + stretching with the focus on vasodilation to promote healing.
Whatever method you choose to do, it's generally accepted good practice to have plenty of fluids during and after your workout with electrolytes and vitamins. Simple sugars, proteins, and vitamins are generally good after a workout. Stretching of course. All pretty basic principles and knowledge. The biggest factor in helping get rid of soreness is just time. Your body needs to heal. Some people push themselves and try to "burn out" the soreness. As far as I know it's not exactly correct and they may potentially cause more damage. I know that some feel it causes larger muscle regrowth through trauma so they do this along with deep tissue massage etc. If so that also causes binding and stiffness which is something people like me do not want. That's my understanding of it which is probably not 100% correct. The safest form of healing in this case is usually time.