Custom customer attribute are throwing error at Customer edit Page - Magento2

We should try with getCustomAttribute()

$block->getCustomer()->getCustomAttribute('codes_for_apply');

You need to add extension_attribute.xml file.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
        <attribute code="codes_for_apply" type="string" />
    </extension_attributes>
</config>

And as @Khoa said try to get the attribute values.