To listeners without perfect pitch, a song played in one key will sound the same if played in another. It’s the relative differences between the notes that matter, not whether that actual note is a C or an E♭.
However, to musicians, key is crucial. Some keys are much more difficult to play than others, some instruments are in different keys than others, and so on. Similarly, composing in different keys matters as well. I have to keep in mind which instruments will play what I’m writing. For example, it wouldn’t make sense for me to write a piece with five flats for a high school string orchestra. I often have to consider the range of the instrument in question when choosing keys.
In a more subtle sense, I’ve realized I make certain compositional choices more in certain keys. I’m not quite sure why that is, but I’ve recently found myself using more accidentals in some keys than others. It most likely has something to do with my familiarity with the key. Keys such as B♭, F, or C are very comfortable keys for me, as I grew up a bassoon player. I tend to default to these keys when I’m composing (or their relative minors). For the piece that I’m working on for the orchestra, however, those keys aren’t such great choices. So I’ve brainstormed many of my ideas in E minor, which is much friendlier to string players. I’ve found that as I forced myself to use unfamiliar keys, I also pushed myself to be more innovative with my melodies through accidentals. There must be a connection there.