On the way to school in Chapter 5, Starr passes by Uncle Carlos's gated neighborhood and wonders whether gates are supposed to keep people out or in. This is important because Starr herself feels caught between worlds. In one, she is part of an African American neighborhood that sometimes struggles. She learns that an old friend of hers is dealing drugs because he has few other choices in life; she's also at a party when gunshots ring out. In her other world, she is one of the few African Americans at her school and constantly feels that she has to change who she is so that no one will think she's "too black."
Another reason this reflection is important is because it sets up the contrast in philosophies between Carlos and Maverick. Carlos lives in this different, gated neighborhood and works as a police officer to try to change his old neighborhood. And Maverick doesn't believe in moving and wants to try to change the culture from inside the neighborhood.
Caught between this conflict, Starr sees the gate as a metaphorical and literal barrier between the two worlds.