You cannot use the object value as a site id value as you thought. :-)
Here is one of the way to use the ID as a number value.
$test = (Get-ChildItem IIS:\Sites|select-object -last 1).id
FYI, here is the way to check the data type.
PS IIS:\sites> (Get-ChildItem IIS:\Sites|select-object -last 1|format-list id | select id).gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
PS IIS:\sites> ((Get-ChildItem IIS:\Sites|select-object -last 1).id).gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int64 System.ValueType