How do I make a transform target a certen tag

So I have this script here

using UnityEngine;
using System.Collections;

public class CameraFallow : MonoBehaviour {

    public Transform myTarget;
	
	// Update is called once per frame
	void FixedUpdate () {

        if(myTarget != null)
        {
            Vector3 targPos = myTarget.position;
            targPos.z = transform.position.z;
            transform.position = targPos;
        }
	
	}
}

And I want it to target an object that has a certen tag, not just a defined object. How do I do that?

GameObject.FindGameObjectsWithTag

As it shows in the example that will return an array of all objects with that tag which you can then loop through.

GameObject.FindWithTag

Or if you know the tag is definitely unique you can use that which will return just a single gameobject.

Best practice is to define it in Start as shown in the example rather than calling it frequently as that is expensive.