The app is often identical either way. What changes is everything around it.

Google PlayAPK from a website
UpdatesAutomaticManual, unless the app checks for updates itself
Device matchingPlay sends the right build for your phoneYou pick the right file for your processor and Android version
Security checksPlay reviews uploads and Play Protect scans installed appsPlay Protect still scans, but you rely on the source being trustworthy
Paid apps and purchasesHandled by Google Play billingPaid apps should not be available as free APKs; if they are, the copy is unauthorised
AvailabilityMay be limited by country or deviceAvailable if the developer publishes it

Mixing the two

An app installed from the developer's website and the same app from Google Play may be signed with different keys. If they are, Play won't update the website version, and you can't install one over the other without uninstalling first. Uninstalling can delete the app's data, so back up first. Signal and WhatsApp both publish website APKs that update themselves, which avoids this problem.

Which one to use

If the app is on Google Play and your phone has Play, that's usually the simpler option. Use an official APK when Play isn't available on your device, or when the developer only distributes the app directly. Either way, the APK installation guide covers the safe way to do it.