After many fork-related shenanigans are had, Woody realises that Bonnie will be okay without him, and he leaves the gang so he can be a lost toy with Bo Peep. It's a difficult decision, but Bo's story has taught him the positives of living their existentially terrifying toy lives on their own terms. The movie ends with Woody helping Bo on her mission while they make a happy home among lost toys who don't want to be groped by sticky fingers anymore.
How It Almost Ended
Instead of Bo Peep convincing Woody that you don't need a kid to be happy, the exact opposite was going to happen. After Woody succeeds in getting Forky back to Bonnie and the other toys, Bo sees a random kid at the carnival and is so porcelain head over heels for her that she decides to abandon her current lifestyle and go back to being someone's toy. Just like that, with no explanation, completely contradicting everything we've learned about this new take on her since the movie started.
Not only does that muddle the message from "You should do what you want with your life" to "It's okay to dabble with freedom, but ultimately you must return to the grinding drudgery that you hated," but it screws over Woody just for the sake of having a bitter ending. His heart is broken a second time, and now he's stuck on his own at the carnival too. Instead of Woody reuniting with his lost love and re-evaluating his life it's like he had a college fling with some flighty weirdo who eventually broke up with him to focus on her Etsy store.