Of course the Captain of a flight can change at any time in the flight, doesn't matter if they don't change seats.
In any flying there should always be a nominated PIC either for the whole flight (perhaps the more experienced) or for each sector.
What is logged is a different matter and depends on who was handling pilot and for how long.
At the end of a single flight, the PPL might log 20 mins whilst the PPL/IR who took over the controls during the flight in IMC logs 40 mins.
What I mean by "nominated PIC" is that someone should always be in charge of the aircraft - for example if something goes wrong, who is going to be responsible.
I have flown in an aircraft with an instructor who wanted to fly across some airspace that I was not happy with. It was my flight but I told him that I was not happy (I was unfamiliar enough with the area not to want to go through it) but he was insistent he knew the route through this busy airspace. I told him that if he wanted to fly the next part as PIC then I would accept his judgement. He did. We went through some very busy airspace around a major international airport. With the wrong route through. He was the one who had to answer to the authorities.
This is just one example of why you should always decide who is overall PIC.