How do I add extra points for coming close to obstacle but NOT for coming close and colliding?

Here is what I have to check to see if object is close:

void CloseCall()
	{
		
		GameObject[] x= GameObject.FindGameObjectsWithTag("xx");
		foreach(GameObject target in x) {
			float distance = Vector3.Distance(target.transform.position, transform.position);
			if(distance < 10 ) {
				
				//if in a certain distance add extra points for near missing obstacles with tag
				
			}
				
		}

I think i figured it out.
My solution was kind of what you said with the triggers but check the players health as soon as it hits trigger and on trigger exit have it add points ONLY if the player has the same health. Or for example if I didn’t have health. Use a count system that checks to see if the number that it is before it hits the trigger is the same after it exits trigger and have it increment on collisions.

Finally had a brain blast today. Hopefully this can help someone in the future.