I guess everyone is different, but I suspect for most, age has something to do with it.
I used to drink coffee all day and night in my 20's, and even my own mother (heavy coffee drinker) would ask me how I could sleep after an after-dinner coffee. I could literally have coffee right before bed, and be nearly unaffected.
As I reached my late-30's or early-40's, that began to change. I remember being really surprised the first time an evening coffee kept me from getting to sleep that night, thinking "well sh*t, this is new."
Now, I try to avoid all caffeinated coffees after 3pm, and have a hard/fast rule at 5pm. If I want an after-dinner coffee these days, which is common here, it has to be decaf. Thankfully, many roasters are making very good decaf beans, these days.