Yeah ideally this happens automatically, if it doesn't it means something about it that is used for mapping is different. If it's a different hostgroup there's no way to merge them without changing the hostgroups.
If it's a separate Process Group look at customizing process group detection so that they are in the same group (PGs serve as a boundary for services). There's also some toggles in the process group detection settings you may look at to see if they apply.
Lastly, if things are in the same process groups and are still detected as different services it could mean you need to look at custom service detection rules.
Below a lot of answers how things work,
You get mergeable services when PGI's are part of one PG. only the PGI "names" differ, so you have to assist Dynatrace by creating a group-name and add them,