 "Sandcastles" was initially written by Vincent Berry II, inspired by the heartbreak of a ten-year relationship with a girlfriend.It was written together with Malik Yusef, who came up with an idea for a track named "We Built Sandcastles That Washed Away" which he sang on a piano with "gospel-influenced lyrics".Vincent Berry II immediately related to the lyrics and promised it would be his "last time writing a song about this girl" while also "putting it all in this".