How does staying close to the target help? They are close not to remain safe but because they don't have long range rockets or missiles to engage the target.
Because an R-73 has a minimum engagement range of 300m from a launch pylon on an aircraft in normal flight... from a ground launch it is probably 4-500m where it wont hit what it is aimed at.
The Ka-29 has all sorts of super cheap guided missiles it could use if money needed to be spent to destroy this target... if it was approaching a large Russian ship they could use Ataka or Shturm missiles for a kill easily enough... those missiles were serially mass produced in enormous numbers for decades.
Hunting down the target with cannon and machine gun fire is cheaper and is more fun.
Direct fire weapons are not designed to be used at such very short ranges so practise against real targets in such situations is important and useful for developing skills and tactics... the Ka-29 is ideal because it is a naval helicopter and has excellent manouver performance and a large cabin and a selection of gun armament options.
They should just start operating naval Ka-52 helicopters to take down drones.
Light troop helicopters with door gunners are often superior in this sort of role than actual gunships.
Using an attack helicopter would be like the police using an actual tank.
Orion drones would be better.
It is rather unlikely they send waves of Ka-29 helicopters out to search for sea surface drones to attack... more likely other platforms like Il-38s and other types are used to detect things on or near the surface and depending on the speed and range of the target and the location of ships and aircraft in the region they will send either Su-30 aircraft or Ka-29 helicopters or Hind helicopters or Hip helicopters to intercept and take down the target.
They could probably send Ka-52s or even Su-57s if they wanted to but Su-30s and Ka-29s will get the job done and post entertaining videos that some will misunderstand no doubt.
The Ka-29 can carry a variety of weapons other than the twin 23mm cannon pod and the nose mounted rifle calibre four barrel gatling and door mounted HMG options.
There are several different gun pod options, including with 30mm grenade launchers or HMG and rifle calibre gatling guns, as well as 23mm and 30mm cannon options.
If they wanted they could even use AT-3 ATGMs for the job to use up old missile stocks, or use newer longer ranged missiles as required.
Ugroza is probably not available so laser guided S-8 and S-13 is out of question. But the Ka-52 could have fired a Vikhr or Ataka laser guided ATGM at this boat to completely destroy it.
If you watch the video again you will see the sea surface drone is a tricky little bugger and can manouver very well, so even with a guided missile if the target turns at the last second even a guided weapon might miss.
This means that the best option is actually guns or cannon and firing bursts of automatic cannon at the target gives you a spread of impacts that mean even last second manouvers wont save the target.
Of course this also takes practise and this is what this crew appears to be doing... getting in some practise and testing the options available to them.
On paper and in theory any of the three gun systems they used in this engagement should have been able to get the job done, though the rifle calibre four barrel gatling might have been a bit light, the HMG and 23mm cannon should have gotten the job done, and if the video had continued we likely would have seen that happen.
Perhaps the pilots were specifically targetting the R-73 because they were not sure what would trigger its launch. Once the R-73 is destroyed the remaining boat could be engaged by an ATGM.
An R-73 is about 70-80kg of solid rocket fuel and about 10-15kg of HE, so if they hit it it would probably destroy the drone as it burned and exploded.
Attacking this sort of highly manouverable target with a supersonic guided missile would be problematic... actually one of their many suicide drones released out the door of the Ka-29 would probably be the cheapest and simplest way of taking out this drone, but as I mentioned practise using cannon and machine guns is useful no matter how you intend to proceed.
These drones are designed for range and performance but the critical and sensitive parts might be armoured to protect from small arms fire and fragments, so HMG and 23mm cannon fire are probably needed to defeat such a target.
A burst of 23mm cannon fire would result in impacts all around the point of aim but at such close ranges working out where the rounds hit can only come from practise... which is what they are doing.
Most sighting systems are not intended to be used at such close ranges so a bit of guesswork is always needed and that is what this practise will be all about.
You can see especially with the HMG out the cabin door the rounds are impacting ahead of the target so over such a short distance he is obviously giving too much lead.