If I modify source code of another open source software then what should I do? Should I seek permission from them?
For the licenses you named (GNU GPL, Apache 2.0) you do not need to explicitly ask for permissions to modify the code. Those are free software licenses which give you the right to modify the source code. So you already have a written statement that you're allowed to do so.
This is why it is important that those files have a licensing header on top which normally contains a copyright notice (basically who wrote this file, when was it written and to which work belongs it) and the packages contain the license text in full, so you can actually read the license text. Some authors only place a link to some third party website, so you actually would not have anything written but only something linked which could have been changed or could go offline.
So if you find a copyright statement and the licensing terms bundled with the code, that's a safe spot.
The right to modify/adapt
Because the right to actually modify source-code is an important one, all free software licenses grant that to you. What's a free software license? In short, check if it is compatible with the GNU GPL. If it is, you can be pretty sure that it is one. Additionally learn about it here: The Free Software Definition.
You can differ between two types/classes of free software licenses: One of the sort like the GNU GPL. Those do not only grant that right to you personally to modify the software, they also grant that right to everybody else whom you pass your (modified) software to as well. For example the users of your software.
That's done to preserve the freedom of software. The idea behind it is basically: What is software w/o it's users? Whom is software written for? What is free software that is not free for its users?
The other type are free software licenses that grant that right to modify to you personally but don't need you to grant the same right(s) on your modifications to the users of your software. IIRC that's like the Apache license, but the type is best known for the BSD-like licenses which probably are a better wording for that type.
This might sound like a slight difference only but it is actually a real(tm) difference. For example if you want your modifications to be let's say GNU GPL'ed so they remain free for all of your code's (potential) users, you need to put it under something like the GNU GPL. But if you don't want that you can not make use of GNU GPL'ed code at all (most code under a free software license is available under GPL).
Some developers consider the GNU GPL as "not free" because they think they're limited by it. In fact they just do not want to conform with a software license that is reciprocal (some name this viral but the adjective is not precise). Instead these developers prefer code under a license that does not requires that (their) modifications are made available upon distribution. In short: they want the benefit of a software only for themselves but not for their users (that's really short and it has some taste. but it's also valid to write so).
I make this bold a bit to better show the difference. In fact every developer always - regardless of free or proprietary software - needs to decide on her/his work which licensing terms to choose at some point. Today as developers we most often do not write software from scratch so we actually create a so called derivate: we modify something existing. So we are already bound to the licenses of some existing software. If we don't like that licensing terms we need to write it from scratch (and we can even do so, because it's totally valid to learn from everything publicly available - imagine if not!).
Distribution is a key point here. Basically it only means that you pass on software to somebody else. And vice-versa: You get software from somebody else.
Without distribution you can actually do everything with source-code you were able to get incl. "illegal" stuff because nobody would ever notice. That's like you've written it on your own but you didn't need to type it into the computer. I love to copy stuff even I can type quite fast.
You do this on your own. This even includes the modification you ask for: As long you do modifications for your own only, you can even ignore any licensing at all (disclaimer: not a legal advice ;) ). Nobody would ever hinder you. Practically nor legally. Because you do that in private and nobody will ever notice. Okay, there is some risk in case somebody will notice for whatever reason but most legal systems do not allow to even use that information against you then. That aspect is probably out of the boundary of your question but it shows that distribution is what matters.
If you modify some software because you play around with that I don't think that practically there is much in the existing law that would hinder you. You might actually need to label your playing as science, but science always was playing so no need to censor yourself.
So just to make the point: For the licenses you named, you can do the modifications on your own w/o asking for an additional consent by the copyright owner (you can always do however in case you are uncertain. but take care: some software developers do not answer if you ask a licensing question about their code they released about five years ago or so, so asking questions to the original author might not actually help you.).
To review: The copyright owner preferred to give you the licensing terms and marked the code on top of the files to be under certain terms and you're free to do the modifications by those terms already (it's always more safe to have the copyright statement and the license with the package).
However read the terms carefully. Some terms say that if you don't conform with something, you will have your rights to modify the software terminated. That might sound dangerous and harsh, but on the other hand keep in mind that most free software licenses contain such termination clauses to ensure that the software stays free. The GNU GPL does this but other licenses well. Just look out for something like termination. The termination clauses always show the expressed wish of a copyright owner how to deal with his software explicitly. It means that a grant is given for something. And that something most often is more than money. Or to say it differently: Money can't buy it.
How to deal with your own modifications?
You asked as well:
Do I need licensing my software by registering somewhere, or I just add the text like described in Apache License 2.0.
Next to registering (which is not necessary nowadays, just publish so you have set a proof-able fact in case you need it) there are as well terms you should consider when you do modifications. Most software licenses - regardless whether begin reciprocal or not - require you to mark your changes next to the existing code. That sort of mark / make visible basically has the meaning that if someone get's your code that it's visible which part of the code has been written by you and which part not. As written above with the different types of the license, there can be a difference which license applies to your modifications.
For that to work you need to make visible where you changed something. So what does this mean in practice? For files which contain a copyright notice on top and you do not make any modifications to it, you do not need to change the copyright notice at all as well because you have not changed anything.
But for files where you actually made some changes (let's not count if you changed a single byte, let's say you've added two more functions with some lines of code and modified some lines of code in an existing function), you should add your copyright on top. I mean really on top, above the original copyright statement. But next to that, you should write after your statement that this file as well is under copyright by someone else followed by their original copyright statement and their licensing description or even terms if the terms were in the original file.
A description how that can be done can be found here: Maintaining Permissive-Licensed Files in a GPL-Licensed Project: Guidelines for Developers. That article might look like being from a GNU GPL viewpoint, but it's written with the best intentions to prevent infringement of copyrights which actually does apply if you license your modifications under your own (place in the name) license as well. So to say: "prevent infringement of copyright" has the purpose to not trigger any termination in the various licenses available so you can license your modifications (the modification you're allowed to if you don't terminate them) under any of your (compatible to the original) terms as well.
Phew what a sentence. Anyway that document explains in detail the what and why and you can easily adopt it to your own licensing as well, I think it's very valuable.
So to resume: If you make modifications to an existing work under copyright, make visible that you changed the file(s) but adding your own(tm) copyright statement and licensing terms and make visible that the files still contain some code under their own copyright and terms.
So next to the code changes you've done you've explained the copyright changes. I think then you're pretty fine to publish things.
This is all personal opinion. I might be wrong with some points, so no warranty of whatsoever. Probably it helps you that you can go on with your question, but it has not been written in any intention of whats-o-ever nor fitting for a particular purpose.