No. You can't use the last block or even the last blocks of CBC encryption as a cryptographic hash. What you describe is a slight generalization of CBC-MAC. CBC-MAC is a one-time authentication code: an adversary who does not have the secret key, and does not have access to authentication tags from distinct messages with the same IV, cannot forge an authentication tag for a new message. CBC-MAC can be made into an actual MAC (not requiring an IV) with a slight modification, with CMAC being a popular standard. However, both for CBC-MAC and CMAC, anyone who knows the secret key can construct collisions.
Consider a block cipher $E$, an IV $\mathrm{IV}$ and a message $P_1||P_2||\ldots$ (cut into blocks for the block cipher). The CBC accumulator calculation after processing the first two plaintext block is $E(E(\mathrm{IV} \oplus P_1) \oplus P_2)$. Let $P'_1$ be any block value:
$$E(E(\mathrm{IV} \oplus P_1) \oplus P_2) = E(E(\mathrm{IV} \oplus P'_1) \oplus E(\mathrm{IV} \oplus P'_1) \oplus E(\mathrm{IV} \oplus P_1) \oplus P_2)$$
Let $P'_2 = E(\mathrm{IV} \oplus P'_1) \oplus E(\mathrm{IV} \oplus P_1) \oplus P_2$: the messages $P_1||P_2||\ldots$ and $P'_1||P'_2||\ldots$ will have the same CBC accumulator, and thus the same hash. This shows that it's possible to construct collisions for any message that's large enough.
It is possible to construct a hash function generally from a block cipher, but you can't just use the block cipher in CBC mode. A popular technique is to construct a one-way compression function and use the Merkle-Damgård construction to build a hash on top of that. At least with this approach, you can't just run the block cipher once per input block.
There are several well-established generic ways to construct a one-way compression function and thus a hash on top of a block cipher: Davies-Meyer, Matyas-Meyer-Oseas, Miyaguchi–Preneel, Hirose, MDC-2 and MDC-4... I'm not familiar with all the constructions and their respective security properties and performance. The only one that I'm aware of that has an established standard is Matyas-Meyer-Oseas (MMO), which is used in a deprecated method to prepare passwords for PBKDF2 in EAP-PSK and in Zigbee (§B.6) (where it's used with HMAC as well).