Do your kids have legal guardians?

I saw a reel about this and it was talking about in an event something was to happen to both parents you would want the children to have a trusted guardian so they don’t end up in foster care. Is this true? How does this work? How do you legally do this? Did you do it??