Difference between SHA256 and SHA3
The main difference of SHA256 and SHA3 are their internal algorithm design.
SHA2 (and SHA1) are built using the Merkle–Damgård structure.
SHA3 on the other hand is built using a Sponge function and belongs to the Keccak-family.
The name might be misleading to think that SHA3 in comparison to SHA2 is just a "newer" version of the algorithm. As SEJPM said: "[...] They share very little beyond the name." The name is just given from NIST and means "Secure hashing algorithm", a family of official standards.
Although you can construct MACs with both SHA256 and SHA3, the SHA3 MAC is easier to use (see fgrieu's comment below).
Output
SHA256 outputs a 256-bit hash.
SHA3 allows outputs of
- 224-bit
- 256-bit
- 384-bit
- 512-bit
hash, although the SHA2-variants (SHA256 is one of these variants) also allows for these lengths.
SHA3 algorithms can be modified to "SHAKE" algorithms and they allow a output of arbitrary length. You can find additional info in this previously asked question.
Security
Hashes that only make use of the Merkle–Damgård structure and output their full (or nearly full) state are vulnerable to length extension attacks.
SHAKE algorithms are also useful for Optimal asymmetric encryption padding.
You can view a direct comparison here (wikipedia).