If you have the option of using accessibility IDs, always use them.

Normally an app developer needs to add these specifically to UI elements in the code. The major benefit of accessibility IDs over XPath or just the id locator strategy is that while app developers add these IDs for testing, users with handicaps or accessibility issues benefit. 

Advantages of Accessible Apps

1. Increased test execution speed

ID Locators are much faster compared to other locator types such as XPath or OS Native locator mechanisms. The main reason for this speed gain is that while locators such as XPath need to traverse the whole App source to find the element you are looking for, ID locators can be found in a single traversal of the code.

2. Stable Tests

ID locators are supposed to be unique.If the developers are careful enough to keep it that way, there won't be any ambiguity in locating an element on the Screen using those ID Locators. They would always point to the right element. This makes the test much more stable and low maintenance.

3. Increase your app's reach

Accessibility is a major factor in the US and UK market to gain market share. People who use screen readers or other devices, and algorithms that inspect UIs, can better navigate your app!

Here's an infographic which gives more info:

How to add Accessibility IDs

On Android, this locator strategy uses the accessibility contentDescription property.

On iOS, this locator strategy uses the accessibility identifier.