It depends on the use case. Sharepoint is good for working with word documents and sharing files. But Confluence is build to structure knowledge. You can edit documents collaborative and find them via full text search. Within a company both tools can be used. Confluence also provides integrations for Sharepoint.
Confluence, unlike Sharepoint, has a different approach to content within sharing and interaction. Confluence is designed to be an enterprise collaboration system. Instead of Word-Files there are Confluence pages, which are continually accessible via the browser and also supporting various forms of rich content, dynamic reports, and threaded discussions. Confluence even allows you to import existing word documents to Confluence wiki pages. Therefore, Confluence is designed to reduce dependence on desktop applications and their documents (e.g. Microsoft Office files locked in email threads and shared drives).