using UnityEngine.UI;

[SerializeField]
private Slider healthBar;

Configure:

healthBar.minValue = 0f;
healthBar.maxValue = maxHealth;
healthBar.value = currentHealth;

Normalized value:

float percentage =
    healthBar.normalizedValue;

You can also build bars using Image.fillAmount.