Nine years previously, following the events of Toy Story 2, Woody and Bo Peep attempt to rescue RC, Andy's remote-controlled car, from a rainstorm. Just as they finish the rescue, Woody watches as Bo is donated to a new owner, and considers going with her, but ultimately decides to remain with Andy. Years later, a young adult Andy donates them to Bonnie, a younger child before he goes off to college. While the toys are grateful to have a new child, Woody struggles to adapt to an environment where he is not the favorite as he was with Andy, apparent when Bonnie takes Woody's sheriff badge and puts it on Jessie instead, not even bothering to give him a role during her playtime.
On the day of Bonnie's kindergarten orientation, Woody worries over her and sneaks into her backpack. After a classmate takes away Bonnie's arts and crafts supplies, Woody covertly recovers the materials and various pieces of garbage from the trash, including a plastic spork. Bonnie uses these to create a bipedal spork with googly eyes, whom she dubs "Forky". Forky comes to life in Bonnie's backpack and begins to experience an existential crisis, thinking he is garbage rather than a toy and wishing to remain in a trash can. As Forky becomes Bonnie's favorite toy, Woody takes it upon himself to prevent Forky from throwing himself away.
When Bonnie's family goes on a road trip, Forky jumps out of the RV window, and Woody pursues him. After Woody explains how important he is to Bonnie, Forky decides to accompany Woody and return to her. Near the RV park where Bonnie's family is staying, Woody spots Bo Peep's lamp in an antique store window and goes in, hoping to find her. Inside, he and Forky encounter a talking doll named Gabby Gabby, who desires Woody's voice box to replace her broken one. Gabby captures Forky but Woody is able to escape. At a playground, Woody is reunited with Bo Peep and her sheep Billy, Goat, and Gruff, who now live as "lost" toys that are not dedicated to one child. Bo agrees to help Woody save Forky and get back to Bonnie.
Meanwhile, Buzz searches for Woody but gets lost at a fairground and becomes a carnival game prize. He escapes with plush toys Ducky and Bunny, and they meet up with Woody and Bo. With the help of pocket toy cop Giggle McDimples and Canadian stuntman toy Duke Caboom, they unsuccessfully try to rescue Forky from Gabby, her ventriloquist puppet henchmen, and the store owner's cat. In the aftermath of the failed rescue, Bo and the other toys argue over whether to go back. Woody declares that rescuing Forky is his remaining purpose and tells Bo that being loyal is something a lost toy would not understand. Alone, Woody encounters Gabby again, who expresses her longing for a child's love. Woody sympathizes with her plight and willingly sacrifices his voice box for Forky.