I turned on AFP when I was unable to connect. That didn't help. Upon your suggestion, I turned it OFF again, but that hasn't helped. As far as I know, macOS prefers SMB over AFP, so not sure if keeping AFP on would make any difference.
That said, my network configurations are fine and the issue is definitely with my Mac settings. I say this because my Mac can connect to all my other devices and those devices can connect with each other as well without any issues. The only connection that isn't working is incoming connections on the Mac. I tried turning off the firewall but that did not help either.
I tried both SMB and SFTP connections using my Mac username and password. The devices can see my Mac but unable to connect.
I even used the "Get info" window for the shared folder and enabled 'Sharing' box there. I am not sure if this was necessary because the folder was already allowed for sharing under system preferences. Ideally, when making a change under system preference, it should also reflect under 'Get Info', isn't it?
Here are the device details:
MacBook Pro running macOS 10.14.6, APFS file system (shared folder is on an unencrypted partition)
iPhone running iOS 13.1.2
Windows 10 Build 1809
Thanks.