Answer: Yes they are like terms
They both have the same variable so that is why they are like terms.
We can think of 'd' representing something like "dogs" maybe
d = 1 dog
2d = 2 dogs
3d = 3 dogs
4d = 4 dogs
and so on
Adding 2d with 4d gets us 2d+4d = 6d meaning we have 6 dogs overall if we started with 2 and added on 4 more. This is one way to help see why we can combine like terms.
In contrast, something like 2c+4d cannot be combined since having 2 cats and 4 dogs doesn't result in 6 cats or 6 dogs. We just simply leave it as 2c+4d.