As long as the airline did not provide at least 14 days’ notice and your flight is eligible under EC 261/04, the answer is yes—passengers can receive both compensation AND a refund.
However, in order to receive the refund, airlines will often ask you to sign a waiver. Some waivers include a forfeiture of compensation clause, effectively making it impossible to also claim compensation. If you plan to file a claim, be sure to read the fine print on anything you sign.
Sometimes airlines offer vouchers but more often then not the voucher is less than the compensation amount you are entitled to. For example, if you are entitled to €600 and airline gives you a €250 voucher to be used with that airline, you are still entitled to the remaining compensation amount of €350. You can also choose to return the voucher and ask for the full compensation amount in cash.