Obviously, you can't use the same name as another BIG, recognizable company. And you also want to avoid trademark issues.
But what about these two scenarios:
If I like a name that's already in use I like to check the US trademark database for the name. If there are already multiple trademarks with the name then there's a good bet that I'll be fine using the name also. You just have to be careful that your industry doesn't overlap with the existing trademarks.
You shouldn't meet problem if that app name is not well-known and not a TRADEMARK. The only drawback is you may make free advertisement for that app if your app is popular in the future. However you can register that trademark at first, and also register possible variations of domains.
Your example itself doesn't have problem. Nobody could stop you from including "sunshine" in you domain name as that is a dictionary word. "sunshine" can't be registered as trademark while "sunshineapp" can.
Besides, legal name is not trademark. There is only trademark infringement in domain name but no legal name infringement.
Disclaimer: I'm not a lawyer and the above answer is based on my own experience and previous research. The above not a legal advice at all. For serious legal consideration you should consult a lawyer.