Problem of ptr and GC

For example, when a character sees another character, add the pointer of the other character to an array so that TAB can be used to switch which character is selected. Can I use TArray<ACharacter*> Or TArray< TObjectPtr > for this array? When the character added to the array is destroyed for offline, dead or other reasons, will the array of other characters prevent its GC?
My current practice is that when switching,
if(!IsValid(SelectedCharacter))
{
Array.Remove(SelecetdCharacter)
}
But I don’t know how to track its actual behavior.

I think it’s fully OK to use TArray for your purpose, but don’t forget to use UPROPERTY() macro in member declaration, unless GC during actors destruction won’t clear ptr’s of deleted actors from array.