What are the use cases where one is preferred over other ?
IEEE1588 PTP is implemented on top of the UDP transport layer.
802.1AS is essentially the same protocol, but implemented directly on the Ethernet layer instead.
You have to use 802.1AS in situations where you need precise time, but don't necessarily have an IP address. For example "Time-Sensitive Networking".
You have to use IEEE1588 PTP in situations where you don't necessarily run on Ethernet, or don't have access to the Ethernet layer.
PTP is an IEEE Standard which means it is simply a published document establishing specifications. It is up to vendors to implement the standard.
Per Wikipedia's List of PTP implementations
Precision Time Protocol (PTP) is a widely adopted protocol for delivery of precise time over a computer network. A complete PTP system includes PTP functionality in network equipment and hosts. PTP may be implemented in hardware, software or a combination of both.
Wikipedia's Precision Time Protocol page states:
IEEE 802.1AS is an adaptation of PTP for use with Audio Video Bridging and Time-Sensitive Networking.