The CancelWorkflow function should be a server-side function. In SharePoint Online,we could not call use any server-side class and function.
And as I test,pnp powershell can not get 2010 workflow instance too.
ShaePoint 2010 Workflow retires soon, please migrate as soon as possible.
Reference:SharePoint 2010 workflow retirement
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.