find the highest gameobject of stacked gameobjects

i am new and i have a game that stack game objects on top of each other and i want to find the gameobject with the highest y value so i can move the camera up to the highest one

Just check all the y values. You can add all the transforms to a list, iterate through and check which has the highest y value.
List stackedObjects;

float highestYValue=0;
foreach(Transform t in statckedObjects)
{
    if(t.position.y>highestYValue)
        highestYValue=t.position.y
}

All you have to do is populate the list.

Alternatively you could probably get the reference as you place the block.