I can give you pointers based on my reading & experience.
If you are dependent on a code which is GPL & including GPL library/code in your code, your code should come under GPL as well.
If you use apache licensed code & including in your code, then you are free to choose any license. As Steve mentioned, you need to mention it in third party dependencies.
This is kind of ThirdParty.txt or dependency section in readme.txt. You need to give the license link & the name of the library you are using.
Now if you want to use GPL & still release your code under different license:
If you are using GPL & providing your code as a free library (under any license), you should not include GPL in there. You can mention the dependency that certain library is required. In this case your code can be under any license. The user/client needs to decide & install/configure that code. You can do some GPL work to make that code as a compiled library, so your code can use it (Library is needed if your code is Java/C/C++.. If its python/perl/js, then client just need to put in correct folder)
The idea behind this is to detach your code from library. I know your code can't be used without that GPL library, however somebody can write non-gpl code for the same functionality in future. This way you keep your code detached from GPL till new code is available & still have your code with different license.
Now coming to selling of such code (not including GPL code, but mentioning dependency). You have to specifically mention the dependency on GPL & let clients download it/configure it (You can make this integration easy by some config)
Hope this helps you..