Tracking changes in velocity

I’m trying to make a game where a sudden change in velocity will cause damage or kill a character, but I’m not sure how to go about it.

I tried setting a variable to the rigid body velocity in update and then checking again in late update to find any changes but that doesn’t seem to work.

I’m quite new to this so I have no clue where to go from here.

This will do it:

    [SerializeField] private float maxChange;
    private Rigidbody rb;
    private Vector3 lastVelocity;

    private void Start()
    {
        rb = GetComponent<Rigidbody>();
        lastVelocity = rb.velocity;
    }

    private void FixedUpdate()
    {
        Vector3 velocity = rb.velocity;
        float dif = Mathf.Abs((velocity - lastVelocity).magnitude) / Time.fixedDeltaTime;

        if (dif > maxChange)
        {
            Damage();
        }

        lastVelocity = velocity;
    }

    private void Damage()
    {
        // Do some damage.
    }