The dunlin we see in the UK in summer are not the same birds we see in the winter. There are actually 11 different races of dunlin with different migratory habits. Three races visit the UK. Birds that breed in Greenland visit in spring and autumn to feed on their way to and from Africa. They are called passage migrants.
Birds that breed in the UK in the summer also travel to Africa for the winter. Yet hundreds of thousands of birds that breed in Scandinavia and Russia spend their winter in the UK.