If I may add to Neville’s post?
Flattening and merging are the same only different!
Flattening reduces the entire layer stack to one background layer and is typically only used to output to a final display format. Such as .jpg or .tif.
“Merging” gives the option of merging layers within a layer stack and that is the basic difference. In other words, in, say, a 6-layer stack you can “merge” two or more of those layers into one layer within the stack. But you can’t “flatten” two or more layers into one layer within the stack.
How's that for "clear as mud"?