How to make car apply damage on collision an object depending on velocity?

Hello, I'm new to Unity and I'm trying to find my way around. I have a racing game and I want my car to apply damage on an object when it hits it. I have attached a "damagereceiver" script to the object. So I need the car to apply damage depending on its speed.

I'm not very good with scripts, I found the OnCollisionEnter script but I'm not sure how to use it.

In pseudo code ( using tags )

On Collision Enter
    If Collider Tag equals VehicleTag
    Variable Velocity = Get Rigidbody Velocity Magnitude
    "use damage code" and multiply it by Velocity

Put this function on everything that you want to damage that car (i.e. road spikes, other cars, etc)

float damageNumber = 2f; // Change this number to increase the amount of damage

void OnCollisionEnter(Collision other) {
    if (other.gameObject.name = "InsertTheNameOfYourCarsGameObjectInsteadOfThis") {
       float damage = damageNumber * other.relativeVelocity.magnitude;
       // The amount of damage is in the variable damage. Use it for
       // your damage code
    }
}