Give someone's good news a little room
When someone shares good news, moving straight to your own story can shorten their moment. One interested question, such as which part they are most pleased about, keeps attention on their experience. You do not need a bigger achievement of your own to contribute to their happiness.
Go deeper
Stay with the news before changing the subject
A friend says they completed a project that took several months. You remember your own difficult project and begin describing it immediately. The connection is understandable, but their news has barely had space to land.
An interested response can extend the moment. You might ask what they enjoyed, which obstacle took the most work or how they plan to mark the occasion.
The questions should follow their mood. Some people want a long conversation; others simply want a warm acknowledgment.
Sharing a related experience can come later. First allowing them to describe what the achievement means keeps the response from turning into a comparison and shows that their particular experience is worth hearing.