What is the coastguard? I read the definitions, but I still don't rule out that a boat that rescues people who get into a city river can be described as the coastguard (in English, there are two separate words for a river bank and a sea coast, as you may know). Is this supposition correct?
The coastguard, in the UK are an emergency service, like the fire brigade or mountain rescue.
Their job is to initiate and coordinate search and rescue at sea.
In the UK, there are no coastguards on inland waters. THere are coastguard stations, for example, at Sheereness and Southend on the Thames estury, but only offices in London, and nothing further upstream.
You might informally refer to a lifeboat that rescues people from a river as "coastguard", but it is not actually the same organisation. I suppose at times the coastguard from Southend will head up river to help with rescues in London. But the prime responsibility in London lies with the Thames River Police, supported by the RNLI
In the USA, the United States Coast Guard is a branch of the armed forces, comparable to the United States Navy, the United States Air Force, the United States Marine Corps, or the United States Army.
If a boat that rescues people is owned and operated by the United States Coast Guard, then it would be considered a Coast Guard boat. If it is operated by some other agency (for example, a local police department) then it would not be called a Coast Guard vessel.
The Coast Guard operates mainly on the sea coasts, but also on the Great Lakes. It also operates on other inland waters. For example there is a Coast Guard station at Lake Tahoe on the California-Nevada border. Regardless of where it operates, it's still called the Coast Guard, the same way a Navy officer or seaman is still part of the Navy even if they are working at an inland location.
In American usage, I'm not aware of any other widely known organization that goes by the name of "coast guard", and I would expect an American to understand any reference to the coast guard (not obviously referring to activities in some other country entirely) to refer to the United States Coast Guard.