It depends on where your B2B takes place. In the U.S., they require you to go through immigration between the cruises, but it's not a big deal.
In Europe, it's different depending on the country. Some require, some do not.
But in none of the situation is it a problem - relatively quick and easy. Some are quicker and easier than others, depending on the cruise line.
And yes, you get credit for 2 cruises if the cruise line you're sailing on still counts cruises instead of days.