Using a while loop in coroutine as a contained Update function

Are there any drawbacks to using

private IEnumerator ContainedFunction()
	{
		while (true)
		{
			this.transform.position = box.transform.position;
			yield return null;
		}
	}

Versus

 void Update()
        {
            if (randomBool)
            {
                this.transform.position = box.transform.position;
            }
        }

If the code it was running was more complex, would I suffer any potential problems?

Coroutine are never a good idea. They are not controllable the way Update is; i.e. they’re a pain. If statements are clutter. So, neither of the methods you displayed is desirable.

Instead, always use a delegate in Update, and add to and remove from it as necessary. Then, you can just disable the script to disable all delegates. I derive from this:

public abstract class AutoDisablingMonoBehaviour : MonoBehaviour {
	Action handleUpdate;
	protected Action HandleUpdate {
		get { return handleUpdate; }
		set {
 			     handleUpdate = value;

			if (handleUpdate == null)
				enabled = false;
			else if (!enabled)
				enabled = true;
		}
	}

	protected virtual void Reset() {
		enabled = false;
	}

	void Update() {
		handleUpdate();
	}
}