Microsoft is in the process of deprecating the MSOnline module and they are yet to update all the affected documentation, as you have noted above. You can of course remove licenses via the UI, but that's only feasible for small tenants. If you want an automated approach, PowerShell remains the best option. Tony has a good script on doing just that here: https://office365itpros.com/2024/04/23/remove-service-plan-powershell-2/
As for the latter part of your questions, removing the license is just a part of the solution. You must also configure the Yammer/Engage settings to block users without license. This is done on a per-network basis, you need to access the Network admin settings > Security settings > toggle the Block Office 365 users without Yammer licenses checkbox under Office 365 Identity enforcement.