Both types can be used as attachments, PDFs are limited to 500KB and XCFs to 2MB (in Gimp 2.8 you can use the compressed variants, .xcfbz2 and .xcfgz (*)), in Gimp 2.10 the newer .xcf has a built-in compression.
(*) .xcfgz and .xcfbz2 are specific types and limited to 2MB, while .xcf.gz and .xcf.bz2 are general GZ/BZ2 types and are limited to 500KB.
(*) .xcfgz and .xcfbz2 are specific types and limited to 2MB, while .xcf.gz and .xcf.bz2 are general GZ/BZ2 types and are limited to 500KB.