How to make my function only search for objects in the same axis? Code included...

I need help only looking for the objects that are on the same height as me. Nothing below or above me. Thanks and here:

	public Transform GetNearestTaggedObject() {
    	var nearestDistanceSqr = Mathf.Infinity;
    	var taggedGameObjects = GameObject.FindGameObjectsWithTag("cover"); 
    	Transform nearestObj = null;
    	foreach (var obj in taggedGameObjects) {
        	var objectPos = obj.transform.position;
        	var distanceSqr = (objectPos - transform.position).sqrMagnitude;
        	if (distanceSqr < nearestDistanceSqr) {
            	nearestObj = obj.transform;
            	nearestDistanceSqr = distanceSqr;
    	return nearestObj;

var heightDistance = Mathf.Abs(objectPos.y - transform.positon.y);
var closeInHeight = (heightDistance < SOME_SMALL_NUMBER);